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

And formula combined with greater than

Hi all,

Just tried to set up an expression where based on two factors QV needs to do come up with volumes.


So basically what I'm saying here, if last year we had volume (either negative or positive) and this year there is also volume (negative or positive), then deduct last years volume of this years volume.

So I created the formula below, but for some reason it doesn't take into consideration the if formula for LY and ACT. Now it's just giving me the difference between both periods.

=IF(sum({<GL_1={VOL},Dimension={LY}>}Data)<>0 AND if(sum({<GL_1={VOL},Dimension={ACT}>}Data)<>0,

sum({<GL_1={VOL},Dimension={ACT}>}Data)-sum({<GL_1={VOL},Dimension={LY}>}Data)

,0))

What am I doing wrong?

3 Replies
Anil_Babu_Samineni

Try this way?

=IF(sum({<GL_1={VOL},Dimension={LY}>}Data)<>0 AND sum({<GL_1={VOL},Dimension={ACT}>}Data)<>0,

sum({<GL_1={VOL},Dimension={ACT}>}Data)-sum({<GL_1={VOL},Dimension={LY}>}Data)

,0)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tim_leijen
Contributor III
Contributor III
Author

Thanks, but didn't work.... still not taking into consideration the if part

Anonymous
Not applicable

try to use addional brackets around the conditional expressions like

=IF((sum({<GL_1={VOL},Dimension={LY}>}Data)<>0) AND (sum({<GL_1={VOL},Dimension={ACT}>}Data)<>0),

sum({<GL_1={VOL},Dimension={ACT}>}Data)-sum({<GL_1={VOL},Dimension={LY}>}Data)

,0)

if still does not work test your expressions step by step using e.g. a textbox

IF(sum({<GL_1={VOL},Dimension={LY}>}Data)<>0,1,0) to test Last year (and maybe select a Dimension)

then test

if(sum({<GL_1={VOL},Dimension={ACT}>}Data)<>0,1,0)

both Expression smust return a 1, then you may test

=IF((sum({<GL_1={VOL},Dimension={LY}>}Data)<>0) AND (sum({<GL_1={VOL},Dimension={ACT}>}Data)<>0),

sum({<GL_1={VOL},Dimension={ACT}>}Data)-sum({<GL_1={VOL},Dimension={LY}>}Data)

,0)