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

Total and Averages for Pivit table

Hi,

I have below fields in my table

Company Name,

Day,

Weekenddate,

Amount.

I need to create a pivot table as shown in attachment, the challenge here for me is for horizontal values i need to show Average and for vertical values need to show sum.

Note: The calculations may not correct in attachment.

I have tried with below expression

Alt(Avg(Aggr(sum(Amount),[Company Name],Day,Weekenddate)),0)

Please help to get the result. Thanks for your time.

3 Replies
sunny_talwar

You should be able to do this using Dimensionality() and SecondaryDimensionality() functions

How to use - Dimensionality()

The second dimension... or how to use secondarydimensionality()

sridhar_sigired
Creator
Creator
Author

Thanks for quick response sunny, i have seen those useful threads.

Still in confusion what will be the expression, if i take SUM, then both horizontal and vertical values are coming as SUM, same case with Avg. Unfortunately i need to handle both cases.

sunny_talwar

It will be fast if you can provide a sample, but the idea is to do something like this

If(Dimensionality() = 1 and SecondaryDimensionality() = 0, then1expression,

If(Dimensionality() = 0 and SecondaryDimensionality() = 1, then2expression, else3expression))