Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
panosalexand
Creator
Creator

Re: Nulls and Zeros in SUM function

Unfortunately, this didn't work for me.  In my example, I try to show all the possible timeslots during the date. 

The data are available from 07:00-09:30 and from 10:30 and so on. I'd like to show that for 10:00 it was zero. 
In my sorting, data are coming for null values(look SORT = 7). 

Is it a setting in the pivot chart or need to change my expression?  ( sum(field) )

panosalexand_1-1700489471669.png

 

Thanks,

PA

 

 

9 Replies
vincent_ardiet_
Specialist
Specialist

Stupid question but are you sure that the Suppress Zero Values or Suppress Missing options are not checked?

 

panosalexand
Creator
Creator
Author

Isn't a stupid question, but yes, options are not checked.
Most probably I have to change the expression in order to get the values without data but I still struggle to find the right.  

vincent_ardiet_
Specialist
Specialist

And have you a filter currently applied? I haven't noticed that SORT 7 is grayed out in the listbox, so it is not available in the current context. 

panosalexand
Creator
Creator
Author

Exactly! I've applied a filter on a particular day. On this day we have production records from 7 am to 7 pm. 
If there isn't a record I need to know this time.

Is something similar to the date. eg You need to know sales for the current year. If you don't have sales for June you will not get the gap and maybe you will not understand it. For this reason you have to apply a master calendar.

vincent_ardiet_
Specialist
Specialist

In this case try something like this:
Rangesum(sum(field),sum({1} 0))

panosalexand
Creator
Creator
Author

Vincent many thanks!! Is working!!!

panosalexand_0-1700552778359.png

 

panosalexand
Creator
Creator
Author

Vincent, I try to apply the same for AVG. 

Redline just a simple average which is the correct --> avg(Field1)

The blue line is what you suggested but with AVG. In this case, I have all the range but the values are approximately half --> Rangeavg(avg(Field1),avg({1} 0))

panosalexand_0-1700572133324.png

 

Do you have any idea?

 

vincent_ardiet_
Specialist
Specialist

Yes, because RangeAvg is doing the average between all arguments.
Keep RangeSum in this case too : 
RangeSum(avg(Field1),avg({1} 0))

panosalexand
Creator
Creator
Author

Thanks for the immediate response