Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Expression

Hi Friends,

 

I have a pivot table in my attached Qv  file. In this pivot table I have two exprression

Exp 1      SUM(NRP)

Exp 2      IF(DAILY_NRP>(NRP),SUM(NRP),SUM(DAILY_NRP))

I am expecting same total Value from both of these expression but it gives two different values. May be My Exp 2 is incorrect But I want to use Exp2 in my Pivot table. Therefore Kindly help me to correct my Exp 2.. I have attached the file pls

2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Try this as 2nd exp:

Sum(IF(DAILY_NRP>NRP,NRP,DAILY_NRP))

View solution in original post

Gysbert_Wassenaar

You need to either use sum in the test in the if statement as well:

IF(sum(DAILY_NRP)>sum(NRP),SUM(NRP),SUM(DAILY_NRP))

Or you need to move the if inside the sum: sum(if(DAILY_NRP>NRP,DAILY_NRP,NRP). If that's what you need then replace the if with a rangemax: sum(RangeMax(DAILY_NRP,NRP))

 


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
tresesco
MVP
MVP

Try this as 2nd exp:

Sum(IF(DAILY_NRP>NRP,NRP,DAILY_NRP))

Gysbert_Wassenaar

You need to either use sum in the test in the if statement as well:

IF(sum(DAILY_NRP)>sum(NRP),SUM(NRP),SUM(DAILY_NRP))

Or you need to move the if inside the sum: sum(if(DAILY_NRP>NRP,DAILY_NRP,NRP). If that's what you need then replace the if with a rangemax: sum(RangeMax(DAILY_NRP,NRP))

 


talk is cheap, supply exceeds demand