Forum Discussion
minhquankhong
5 years agoFrequent Visitor
How to set up weighted average for multiple years
I have set up measures to get the percentage of total foreign sales over total gross income for 2007 - 2013. However, I do not know how to set up the weighted averages. Below are examples of my quest...
- 5 years ago
Hi, minhquankhong
It’s my pleasure to answer for you.
According to your description,I think you can create four measures to calculate the desired result.
Like this:
weighted average4 = var a=CALCULATE('Measures 1'[% of AFBI/Total Income],'PL_Domestic Entitiies'[Year]="2011") var aa=CALCULATE('Measures 1'[Total AFBI],'PL_Domestic Entitiies'[Year]="2011") var b=CALCULATE('Measures 1'[% of AFBI/Total Income],'PL_Domestic Entitiies'[Year]="2012") var bb=CALCULATE('Measures 1'[Total AFBI],'PL_Domestic Entitiies'[Year]="2012") var c=CALCULATE('Measures 1'[% of AFBI/Total Income],'PL_Domestic Entitiies'[Year]="2013") var cc=CALCULATE('Measures 1'[Total AFBI],'PL_Domestic Entitiies'[Year]="2013") return DIVIDE(c*cc+b*bb,c+b)*DIVIDE(2,3)+DIVIDE(a*aa,a)*DIVIDE(1,3)Here is my sample .pbix file.Hope it helps.
If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
minhquankhong
5 years agoFrequent Visitor