Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Weighted Averages

I've searched but haven't found my solution.  I need to create a weighted average.  I want to weight it based on LinesNr.  The measure I want to weight is Rev.  I created a simple expression that seems to work at the subtotal level, (2?), but not the line-item level (3?).  It is LW_Avg = Sum(Rev) * Sum(LinesNr).  Then I created another expression which is LW_Avg / LinesNr.

What is the proper way to get a weighted average at the right subtotal level?

Thanks.

2 Replies
Not applicable
Author

Could be = Sum(Rev * LinesNr) / Sum(LinesNr)

With one or two expressions, it is up to you.

JG

Not applicable
Author

Thanks, but I'm trying to do this in a Pivot Table and it seems to be working at Dimensionality=2, but not 1 or 0.  I've been playing around with the formula but still haven't found the answer.  Any other suggestions?

I think part of the problem is the field/number I want to be a weighted average is already an "average" number (i.e. Avg. Rev).

I've attached a file with sample data, this time trying to calculate average Margin%.

Thanks!