Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Strange Pivot Table behaviour

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.

1 Solution

Accepted Solutions
petter
Partner - Champion III
Partner - Champion III

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:

2017-01-05 13_19_21-Edit Expression.png

View solution in original post

6 Replies
petter
Partner - Champion III
Partner - Champion III

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:

2017-01-05 13_09_24-.png

I high-lighted (selected) what I added in black in the above screenshot...

petter
Partner - Champion III
Partner - Champion III

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:

2017-01-05 13_19_21-Edit Expression.png

Not applicable
Author

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 🙂

petter
Partner - Champion III
Partner - Champion III

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.

Not applicable
Author

Thanks Petter for your help, yes will take me some time to get my head around it.

petter
Partner - Champion III
Partner - Champion III

Thanks, please mark the question as answered to close this thread