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

Weighted average in Total Row in a pivot table

Capture11.JPG

Is there a way to replace the sum in Total row with this weighted average calculation? Thanks

1 Solution

Accepted Solutions
sunny_talwar

Try this

If(Dimensionality() = 1,

Sum(AVG_BAL * If(Mod(RPT_PRD_DATE_YR, 4) = 0 and Mod(RPT_PRD_DATE_YR, 100) <> 0, 366, 365)/RPT_DAYS)/Sum(Aggr(Only(If(Mod(RPT_PRD_DATE_YR, 4) = 0 AND Mod(RPT_PRD_DATE_YR, 100) <> 0, 366, 365)/RPT_DAYS), RPT_DATE_YR, RPT_DATE_MTH)),

Sum(AVG_BAL))


Capture.PNG

View solution in original post

5 Replies
sunny_talwar

May be this

If(Dimensionality() = 1, Sum(AAA*HHH)/Sum(HHH), Sum(AAA))

phoenix
Creator
Creator
Author

stalwar1‌ can you take a look at the app? trying to get the logic work in this example. Thanks

Sergey_Shuklin
Specialist
Specialist

Hello!

You can use special calculating condition IF RowNo() = 0.

wavg.png

sunny_talwar

Try this

If(Dimensionality() = 1,

Sum(AVG_BAL * If(Mod(RPT_PRD_DATE_YR, 4) = 0 and Mod(RPT_PRD_DATE_YR, 100) <> 0, 366, 365)/RPT_DAYS)/Sum(Aggr(Only(If(Mod(RPT_PRD_DATE_YR, 4) = 0 AND Mod(RPT_PRD_DATE_YR, 100) <> 0, 366, 365)/RPT_DAYS), RPT_DATE_YR, RPT_DATE_MTH)),

Sum(AVG_BAL))


Capture.PNG

phoenix
Creator
Creator
Author

Thanks stalwar1‌ that worked