Forum Discussion
Trying to get Dynamic Weighted Average
- Anonymous9 years ago
rvokkarane wrote:
Lydia,
The final goal is to get to % value. For example: between given two dates, SUM of LOAN of 150-159/SUM of all Loans. Again between two dates, not all time.
Hi rvokkarane,
Create the following measures, check if percent returns your expected result.
Sum of loan of score group between dates = CALCULATE(SUM(Query1[LOAN]),ALLSELECTED(Query1[Date]))
Sum of all loan between dates = CALCULATE(SUM(Query1[LOAN]),ALLSELECTED(Query1[Score Group]))
percent = [Sum of loan of score group between dates]/[Sum of all loan between dates]
You can see the example. - Anonymous9 years ago
Hi rvokkarane,
Please ensure that you create a measure named ww as shown in the following screenshot? If the issue still persists, please share me your PBIX file so that I can test.
Thanks,
Lydia Zhang
rvokkarane wrote:
Lydia,
The final goal is to get to % value. For example: between given two dates, SUM of LOAN of 150-159/SUM of all Loans. Again between two dates, not all time.
Hi rvokkarane,
Create the following measures, check if percent returns your expected result.
Sum of loan of score group between dates = CALCULATE(SUM(Query1[LOAN]),ALLSELECTED(Query1[Date]))
Sum of all loan between dates = CALCULATE(SUM(Query1[LOAN]),ALLSELECTED(Query1[Score Group]))
percent = [Sum of loan of score group between dates]/[Sum of all loan between dates]
You can see the example.
Lydia,
Thank you so much for helping me, it worked. :)
But I did run into a problem. If you look at the picture below, the column ww which sum of score group by dates, some groups are totalling wrong. In this example, the group 160-169 and 170-179 and so on, the loan column and ww should be the same but it doesn't seem to be.
Thank you so much again.
- Anonymous9 years agoNot applicable
Hi rvokkarane,
Please ensure that you create a measure named ww as shown in the following screenshot? If the issue still persists, please share me your PBIX file so that I can test.
Thanks,
Lydia Zhang- rvokkarane9 years agoFrequent Visitor
Lydia,
It worked. Thank you so much.
While I was trying to solve this problem. I think I came across a easier way to solve this problem.
For example: The loan column from my query, just use the same column again and do a quick calculation, then do a sum and percent of grand total and gives us the dynamic weighted avg %.
I did use your formula to calculate a different calculation.
Again thank you so much :)
I appreciate it so much.