Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to display 0 when there is no record

Hi,

I create a straight table to show the sales of each month, dimension is from April to September, expression is SUM(Sales). The source data is

CustomerSalesDate
cust1104/10/2013
cust1205/1/2013
cust220

4/20/2013

Now the straight table can only show April and May and the correspinding sales, I want other months to display as well with sales 0, how can I do this?

Thanks in advance for your help.

1 Solution

Accepted Solutions
amien
Specialist
Specialist

Dear Julialiu,

unchecking supress zero values is not going to work because these dates proberbly don't have any record, so not even a 0.

Please read this thread.

http://community.qlik.com/docs/DOC-3786

View solution in original post

9 Replies
nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hiii julialiu,

In the presentation tab => UnCheck  Supress Zero Values.

you will get all data including Zero sales.

-Nilesh

amien
Specialist
Specialist

Dear Julialiu,

unchecking supress zero values is not going to work because these dates proberbly don't have any record, so not even a 0.

Please read this thread.

http://community.qlik.com/docs/DOC-3786

Not applicable
Author

Hi Nilesh,

The Supress Zero Values is unchecked in my above case. Because there is no record in other months, the sales is not calculated as 0 with expression SUM(Sales), instead there is no value at all.

nilesh_gangurde
Partner - Specialist
Partner - Specialist

Hii julialiu,

Ohhkk you can add sales as 0 or Null at load time.

for that your script will be like this.

load

Customer,

Sales,

if(isnull(Sales) or Sales = '' or len(Sales) = 0,0,Sales) as SalesField,

Date

From Source;

You can replace the 0 with null() for null values.

OR

you can uncheck the "Suppress when value is null" in the Dimension Tab.

-Nilesh

Not applicable
Author

Thank you Amien, the doc is very helpful.

Not applicable
Author

Hi Nilesh,

Thanks for your help, I did it by Join the Calendar table and the Source table, and give some value to the NULL field.

And just FYI, uncheck "Suppress when value is null" will not do the trick.

Not applicable
Author

in your expression write this code

if(Sales=' ', '0',Sales)

er_mohit
Master II
Master II

see the attached file

sujeetsingh
Master III
Master III

Try like this:

if(isnull(Sales)<>0,Sales)