Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
xnatsu24
New Member

aggregate using the rank measure

https://preppindata.blogspot.com/2023/02/2023-week-5-dsb-ranking.html

this is my table - I wanted to aggregate the total  by their rank using a measure

MonthBankSum of Valuerank
AprilDTB423601
AprilDS407852
AprilDSB303173
AugustDS1022371
AugustDTB660632
AugustDSB381673
DecemberDTB637971
DecemberDS339522
DecemberDSB207853
FebruaryDTB434001
FebruaryDS312042
FebruaryDSB286223
JanuaryDTB670631
JanuaryDS502072
JanuaryDSB450363

 

 

the result should be like this

rankAverage of Sum of Value
166967.75
248633.67
334620.83

 

I achieved this by exporting the data and uploading it as a new table.
I wanted to know it was possible to get the same result with a measure

thanks

 

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @xnatsu24 

According to your description, you create a rank measure to get the rank . And you want to group by the rank and get the average of the value .

Here are the steps you can refer to :
(1)This is my test data and my understand for your need:

vyueyunzhmsft_0-1687745476711.png

(2) We can click "New Table" to create a dimension table :

Table 2 = var _max_count = MAXX(SUMMARIZE('Table','Table'[Month],"count" ,  COUNT('Table'[Bank])) , [count])
return
GENERATESERIES(1,_max_count,1)

 

(3)Then we can click "New Measure" and enter this to create a measure:

Measure = var _t =ADDCOLUMNS( SUMMARIZE('Table','Table'[Month],'Table'[Bank],"value", SUM('Table'[Value])) , "rank" , [rank])
var _cur_rank = VALUES('Table 2'[Value])
return
AVERAGEX(FILTER(_t, [rank] in _cur_rank) , [value])

Then we can put the fields we need on the visual and we can get this:

vyueyunzhmsft_1-1687745554119.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

This can be solved with a disconncted table.  Share the raw sample data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-yueyunzh-msft
Community Support
Community Support

Hi , @xnatsu24 

According to your description, you create a rank measure to get the rank . And you want to group by the rank and get the average of the value .

Here are the steps you can refer to :
(1)This is my test data and my understand for your need:

vyueyunzhmsft_0-1687745476711.png

(2) We can click "New Table" to create a dimension table :

Table 2 = var _max_count = MAXX(SUMMARIZE('Table','Table'[Month],"count" ,  COUNT('Table'[Bank])) , [count])
return
GENERATESERIES(1,_max_count,1)

 

(3)Then we can click "New Measure" and enter this to create a measure:

Measure = var _t =ADDCOLUMNS( SUMMARIZE('Table','Table'[Month],'Table'[Bank],"value", SUM('Table'[Value])) , "rank" , [rank])
var _cur_rank = VALUES('Table 2'[Value])
return
AVERAGEX(FILTER(_t, [rank] in _cur_rank) , [value])

Then we can put the fields we need on the visual and we can get this:

vyueyunzhmsft_1-1687745554119.png

 

 

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem. (You can also upload you sample .pbix [without sensitive data] to the OneDrive and share with the OneDrive link to me ! )

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.