Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Weighted Average calculation for totals in a pivot table

Hi,

I'm trying to find a solution to calcuate a weighted average in QV for the totals in a pivot table.

In the enclosed file I marked the cells yellow which I want to calculate in QV.

Maybe some of you faced the same problem and have an idea?

Thanks a lot in advance!

Kind regards

John

1 Solution

Accepted Solutions
marcus_sommer

I think you will need a formula like these:

= if(dimensionality() < 4, sum(total Time * [Max Speed]) / sum(total Time), sum([Max Speed]))

The matching to the dimensionality and the total-statements <Field(s)> will probably need some adjustment. Also have a look here: Average – Which average?.

- Marcus

View solution in original post

2 Replies
marcus_sommer

I think you will need a formula like these:

= if(dimensionality() < 4, sum(total Time * [Max Speed]) / sum(total Time), sum([Max Speed]))

The matching to the dimensionality and the total-statements <Field(s)> will probably need some adjustment. Also have a look here: Average – Which average?.

- Marcus

Not applicable
Author

Thanks a lot!

Also the article is very helpful.