Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
venky77777
Contributor III
Contributor III

Total not getting when using count(customer id) in qliksense table with if condition

Hi,

Can any one help me why I'm not getting count(customer id) in qliksense table using 'if' condition. Please see the below data in table:

venky77777_0-1715702808519.png

Thanks

Labels (3)
2 Solutions

Accepted Solutions
Vegar
MVP
MVP

TRy to change the totaling on the measures from "Auto" to "Sum" in the property pane.

Vegar_0-1715713097929.png

 

View solution in original post

Vegar
MVP
MVP

In the KPI object you don't have the CID dimension to split the expression over. 

 

You will need to calculate the if statement per CID dimension value and then sum all those result. You can do that by wrapping sum(aggr(..., CID)) around you expression, like this:

sum(aggrif(sum(GROSS)<sum(NET),count(CID)), CID))

View solution in original post

7 Replies
Vegar
MVP
MVP

It looks like you are getting values when using if statements in your chart. 

Please point out whats wrong and explain your expected output.

Vegar
MVP
MVP

Is it the CID =109 that is causing  you trouble? I notice that sum(NET) = sum(GROSS) and none of your if statement cover that scenario.  You are only using larger or smaller than.

venky77777
Contributor III
Contributor III
Author

I want total as 8 in "if(sum(GROSS)<sum(NET),count(CID))" column and 2 as total in "if((GROSS)>=(NET),count(CID))"

venky77777_0-1715711826125.png

 

Vegar
MVP
MVP

TRy to change the totaling on the measures from "Auto" to "Sum" in the property pane.

Vegar_0-1715713097929.png

 

venky77777
Contributor III
Contributor III
Author

Thanks @Vegar ,that's working.

But when I use in KPI it is showing like below:

venky77777_1-1715713832966.png

 

venky77777_2-1715713892286.png

 

 

Vegar
MVP
MVP

In the KPI object you don't have the CID dimension to split the expression over. 

 

You will need to calculate the if statement per CID dimension value and then sum all those result. You can do that by wrapping sum(aggr(..., CID)) around you expression, like this:

sum(aggrif(sum(GROSS)<sum(NET),count(CID)), CID))

venky77777
Contributor III
Contributor III
Author

Thanks @Vegar , it's working.