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

sum of If statement

Hello,

 

I have this if statement below. The logic is great but why does it only sum up the [GL Budget $]? 

IF(isNull([JC Job Desc]), [GL Budget $], num(sum(distinct [Max Cost Budget Closing]),'#,##0.00;-#,##0.00'))

I would expect it to sum up all values in the column calculated by the if statement.

 

FYI: [GL Budget $] is a measure that sums all the gl budget while [Max cost budget closing] is a field

 

Thank you

Labels (2)
1 Reply
hic
Former Employee
Former Employee

Because there are probably multiple values of [JC Job Desc], and then it is evaluated to NULL. So your condition is always true.

Wrap [JC Job Desc] in an aggregation function.

See more on https://community.qlik.com/t5/Design/Use-Aggregation-Functions/ba-p/1475833