Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to make calculation on Part Numbers only if their total quantities are above a certain value.
Threshold value is in a variable (vLower)
Measure below is sending figures that are not what I expect. I suspect it to sum only unit Quantity above the threshold.
=Sum(if(PN=aggr(if(sum(Quantity)>=$(vLower), PN), PN), Quantity))
Notes
* for testing I created below dimension to flag the PN I had an interet in. This works
=aggr(if(sum(Quantity)>=$(vLower), DPN), DPN)
* I also tried to build a set but with no success
=Sum({<PN=P({<PN={"aggr(if(sum(Quantity)>=$(vLower), PN)"}>} PN)>} Quantity)
Any help or hint would be more than welcomed
Thx
C.
Hi Christophe,
I think you are overly complicating your solution. All you need is a static dimension PN (no need to create a dynamically calculated dimension, just let QlikView filter the dimension values based on the Expression).
In the expression, you just need a Set Analysis with an Advanced Search filter like this (just edited it, it wasn't simplified enough...):
=Sum({<PN={"=sum(Quantity)>=$(vLower)"}>} Quantity)
- You don't need AGGR, because a filter on the field PN serves as an implied AGGR by PN
- Your don't need an IF statement, because the Advanced Search, enclosed in double quotes and starting with the equal sign {"=..."}, serves as a condition.
This is it. It's actually a lot simpler than you thought.
Cheers,
Oleg Troyansky
Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy!
Hi Christophe,
I think you are overly complicating your solution. All you need is a static dimension PN (no need to create a dynamically calculated dimension, just let QlikView filter the dimension values based on the Expression).
In the expression, you just need a Set Analysis with an Advanced Search filter like this (just edited it, it wasn't simplified enough...):
=Sum({<PN={"=sum(Quantity)>=$(vLower)"}>} Quantity)
- You don't need AGGR, because a filter on the field PN serves as an implied AGGR by PN
- Your don't need an IF statement, because the Advanced Search, enclosed in double quotes and starting with the equal sign {"=..."}, serves as a condition.
This is it. It's actually a lot simpler than you thought.
Cheers,
Oleg Troyansky
Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy!
You're great! I spent the afternoon on this ...
Just one copy paste correction: =Sum({<PN={<PN={"=sum(Quantity)>=$(vLower)"}>} Quantity)
Thx,
=SUM({<PN = {"=SUM(Quantity) >= $(vLower)"}>}Quantity)
Yeah, I copied your formula and I didn't remove enough 🙂 thanks to Manish for correcting it!