Forum Discussion
hhoward8
8 years agoFrequent Visitor
weighted average
Hi everyone! I'm trying to create a type of average. The example in excel is as shown: Payment Receiving Day Buckets Days Amount Days*Amount 1-30 30 $ ...
v-xjiin-msft
8 years agoSolution Sage
Hi hhoward8,
=> I'm trying to show this Average for of our Top N (10) payers in a single table.
How could we know which payers are the top N? Does there exist a sequence column?
Generally to get top n rows in Power BI, we can use RANKX() function to make an order. Let's make a sample based on your sample data to get top 10 rows total amount and average amount.
You can use RANKX() function to make an order.
Rank = RANKX ( Table1, Table1[Days],, ASC, DENSE )
Then use this Rank to get top 10 total amount and average amount.
Top 10 total amount = CALCULATE ( SUM ( Table1[Amount] ), Table1[Rank] <= 10 ) Top 10 days = CALCULATE ( MAX ( 'Table1'[Days] ), Table1[Rank] = 10 ) Top 10 average = [Top 10 total amount] / [Top 10 days]
Thanks,
Xi Jin.