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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to rank by month and year?

Good afternoon! 

Could you help me with measure to sort by "year & month" ascending?

Now it doesn't work as  wish to get

I want to get the next: 
202201 - 1

202202 - 2
...

202303 - 13
and so on
dax file:

https://disk.yandex.ru/d/B1gobUijeWcvDw   

 

evpopov04_0-1683716510482.png

 

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

RangeMonthYear = 
var _a = RANKX(ALL('Календарь'),[Сорт Год_Мес],SELECTEDVALUE('Календарь'[Сорт Год_Мес]),ASC,Dense)
return SELECTEDVALUE('Календарь'[Сорт Год_Мес])&" - "&_a

Final output:

vjianbolimsft_0-1685005890149.png

Best Regards,

Jianbo Li

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

eliasayyy
Memorable Member
Memorable Member

hello i have another work around create a month id new column to the atbel 


Month ID = 
VAR _min = YEAR(MIN('Table'[Date]))
RETURN
MONTH('Table'[Date]) + (YEAR('Table'[Date]) - _min) *12

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.