Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable used in a definition

Hi, i am just learning how to create a dashboard etc.

I have two calculated fields:

Sum ([Sales value Act]) / Sum ([Weight Act]) which is called Pr/Kg Act

Sum ([Sales Value Ant]) / Sum ([Weight Ant]) which is called Pr/Kg Ant

I now need to subtract Pr/Kg Ant from Pr/Kg Act to give me a total, which i will then use in the report with a predefined red arrow.

I have created two variable for each of the calculations:

PrKg Act & PrKg Ant, both use the calculations above.

In the definitions i have now put:

= if (sum ([PrKg Act]-[PrKg Ant]) > 0, 'qmem://<bundled>/BuiltIn/arrow_ne_g.png', 'qmem://<bundled>/BuiltIn/arrow_s_r.png')

The result is everything is a red arrow, and it should not be!!

Any ideas on where i am going wrong. The expression is okay just not showing the right results..

Many thanks for any help

Kevin

1 Reply
Gysbert_Wassenaar

You're doing something like sum(sum(something)-sum(somethingelse)). And that's not possible. You'll have to use the aggr function to aggregate the sums over some dimensions, sum(aggr(sum(something)-sum(somethingelse),DimensionP,DimensionQ)),

or rethink your expression altogether. Maybe just if([PrKg Act]-[PrKg Ant] > 0 , xxx, yyy )


talk is cheap, supply exceeds demand