Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

sofiavaz
Contributor

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!

Community Browser