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

Average of weighted average

I am trying to calculate an average across all dimensions of a calculated weighted average.

Let's use the below pivot table as an example.

sample.JPG

I have 4 dimensions: year, units (20,30,50), dimension1 (a,b) and dimension2(1,2,3)

First I'd want to calculate the weighted average based off of the units.  I used an expression:

=(SUM(Units)/(SUM(TOTALUnits)))*value

That gives me:

sample2.JPG

That part that I am stuck on is how do I get the averages of the new weighted values above but using less dimensions?

Final results I want to see are:

sample3.JPG

Thanks

1 Solution

Accepted Solutions
sunny_talwar

May be this

Avg(Aggr((SUM(Units)/(SUM(TOTALUnits)))*value, dimension1, dimension2, year, units))

View solution in original post

1 Reply
sunny_talwar

May be this

Avg(Aggr((SUM(Units)/(SUM(TOTALUnits)))*value, dimension1, dimension2, year, units))