Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sum(if(...)) vs. if(...), "Total Mode": Sum

I have an IF condition: if(Customer_ID > 100 and Item>40 and Item <=20,1,0) and would like to get the sum of this to be used in a bar chart.

When I calculate the value of this expression in a straight table for every data set and sum them up with the total mode i get nice results:

if(...)

On the otherhand, if I take the sum already in the expression of bar chart. It tells me that there would be "no data to be displayed". :

sum(if(...))

Does anyone have a clue why this does not behave the same way?

Best,

Jonas

1 Reply
swuehl
MVP
MVP

I assume your straight table has some dimensions, right? These dimensions group your data records such that each line, i.e. the if() function, will evaluate to one unambiguous result, zero or one.

If you use your expression in a chart with no or other dimensions, you probably won't get a single answer to the if() statement, so the if() will return NULL, therefore you will get "no data to display".