Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Issue with an if expression

Hi all,

I have this calculated dimension as pivot table column:

=if((AllocTransfOrigProdmktOrc=AllocTransfDestProdmktOrc),'NEUTRAL',

  IF((AllocTransfOrigContribEurTon=0 OR AllocTransfDestContribEurTon=0), 'UNDEFINED',

    IF(AllocTransfOrigContribEurTon<AllocTransfDestContribEurTon,'UPGRADE',

          IF(AllocTransfOrigContribEurTon>AllocTransfDestContribEurTon,'DOWNGRADE','XXX'))))

On the same pivot, i want to calculate a measure for all cases less 'NEUTRAL' and 'UNDEFINED', so I wrote this:

=if((AllocTransfOrigProdmktOrc=AllocTransfDestProdmktOrc) OR (AllocTransfOrigContribEurTon=0 OR AllocTransfDestContribEurTon=0),NULL(),

  if(getfieldselections(AllocTransfInsDate)>0,

  sum({<AllocTransfTransfStat={"APPROV"}>}(AllocTransfDestContribEurTon-AllocTransfOrigContribEurTon)*AllocTransfOrigTons),

  sum({<AllocTransfTransfStat={"APPROV"},AllocTransfInsDateYear={"$(=Year(Today()))"}, AllocTransfInsDateWeek={"$(=vCurrentInsDateWeek)"}>}(AllocTransfDestContribEurTon-AllocTransfOrigContribEurTon)*AllocTransfOrigTons)))

the problem is that values are still being calculated for cases where I do not want this to happen... Can anyone help me solving this?

Any help will be appreciated!

Thank you!

0 Replies