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

IF and OR in calculated dimension

Hello all,

=if((if((KREDIT/100)=0 OR
(DEBET/100)=0 OR
((sum(if(NUMBERDRIVE>=1,((KREDIT/100)-(DEBET/100)))))/(sum((KREDIT/100))))>=0.25 OR
((sum(if(NUMBERDRIVE>=1,((KREDIT/100)-(DEBET/100)))))/(sum((KREDIT/100))))<=-0.25,((NAME)),null())
)>='a',NUMBER,null())

This calculated dimension in my standard table give as answer: mistake. How is that possible and is there somebody who can helps me?

Best regards, Li

1 Reply
hic
Former Employee
Former Employee

Because it is not well defined. You have a mix of naked field references and aggregations and it is not well defined how these should be calculated. Should the summation be made per transaction, per account, per month or per cost center? Compare with a SQL GROUP BY.

The solution is to use an Aggr() function, where you define your grouping symbols and your aggregations separately:

=Aggr(<expression>, TransactionID)

or something similar.

See Calculated Dimensions

Pitfalls of the Aggr function

HIC