Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I am experiencing strange behaviour in a pivot table as per attached application.
I am calculating a 9 Week Average of Unique Customers, matching the dimension from an inline load of fixed values.
When Unique Customers is the first in the list of the Inline Load (as per Metric table), the 9 Week Average is calculated correctly, but when the Unique Customers is NOT the first in the list of the Inline Load (as per Metric2 table) the calculation is not evaluated.
Can anyone solve and explain this please?
Thanks.
The explanation is that you have to let the Aggr function aggregate over all necessary dimensions.
When you have a single row selected in your Pivot Table it will sort of act as an aggregation for the Metric2 with only one value which is "Unique Customers" - that is why it is able to calculate correctly. If you have none of the Metric2 values selected it will force a Null() value because of your If( ... ) and then of course it will turn into a Null value for the Aggr too.
You should simplify your expression removing the If so it becomes like this:
If you change expression 2 in the Pivot Table and add an extra aggregation dimension to your Aggr-function it seems to work as you want it to:
I high-lighted (selected) what I added in black in the above screenshot...
The explanation is that you have to let the Aggr function aggregate over all necessary dimensions.
When you have a single row selected in your Pivot Table it will sort of act as an aggregation for the Metric2 with only one value which is "Unique Customers" - that is why it is able to calculate correctly. If you have none of the Metric2 values selected it will force a Null() value because of your If( ... ) and then of course it will turn into a Null value for the Aggr too.
You should simplify your expression removing the If so it becomes like this:
Ok, Great so I had to Include Metric2 to the Aggr as a dimension as well... Thanks, but really strange how QlikView works this out 🙂
It can be hard to understand - it has taken me a while to get to grips with it. It is not so strange once you get past the first few advanced/complex use-cases with Aggr.
Thanks Petter for your help, yes will take me some time to get my head around it.
Thanks, please mark the question as answered to close this thread