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

Weighted Average Rate

I am trying to calculate the weighted average rate for the below sample data in which i am showing only one product as A which has multiple customers having different rates and amount.

ProductAccRateAmountWght Avg AmtWght Avg Rate
AA000013.25    26,871.08     87,331.01
AA000023.25    26,871.08     87,331.01
AA000033.25    26,871.08     87,331.01
AA000043.25    26,871.08     87,331.01
AA000051.25       5,321.88       6,652.35
Total   112,806.20      355,976.39                  3.16

Formulas:

1. Wght Avg Amt = Rate * Amount

2. Wght Avg Rate = Sum of Wght Avg Amt / Sum of Amount

Output I am looking for is Productwise Wieghted Average Rate as follows:

ProductWeighted Avg Rate
A                 3.16
B                 2.45
C                 3.12
D                 6.50
1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Have product as dimension.

     Expression as =Sum(aggr(Avg(Amount*Rate),Acc))/Sum(Amount)

Hope it helps
Celambarasan

View solution in original post

3 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     Have product as dimension.

     Expression as =Sum(aggr(Avg(Amount*Rate),Acc))/Sum(Amount)

Hope it helps
Celambarasan

tresesco
MVP
MVP

Hi,

have a look at the attachment. hope this helps.

Regards,  tresesco

shumailh
Creator III
Creator III
Author