Dashboards & Visualizations

fillnull is notworking

abdul
Explorer

Citry contains 12 names. in result i am able to see only city name with product
if product is zero it is not showing the Citry name


base search |stats count(product) AS Total BY City |fillnull value=0 City

CitryTotal
citry11
citry550
citry1015


expectation 

CitryTotal
citry11
citry20
citry30
citry40
citry550
citry60
citry70
citry80
citry90
citry1015
citry110
citry120
Labels (1)
Tags (1)
0 Karma

somesoni2
Revered Legend

The fillnull works for populating columns with missing data when the row exists. Your query will only list Cities for which it finds data. To get data for allCities, you'll need to provide the whole list to Splunk so that even the missing ones show up with 0 count.

Step 1: Build a list of allCities in a lookup table. Say All_Cities.csv. This can be a static CSV or dynamically generated, based on your data.

Step 2: Append data from this lookup to your search and re-build stats. Like this

base search |stats count(product) AS Total BY City
| append [| inputlookup All_Cities.csv | table City | eval Total=0]
| stats max(Total) as Totak by City

 

ITWhisperer
SplunkTrust
SplunkTrust

fillnull works, the issue is that you don't have any events returned by the stats for all the cities you were expecting - splunk doesn't usually make stuff up unless you tell it to!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...