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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
abelbb
Regular Visitor

ordering months

abelbb_0-1684231340960.png

i have the above column in my dataset table and August to December represent a different year from the January to December and onwards. How do i creat a custom column that sorts the months according to the different years?

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @abelbb 

 

You can try the following methods. In the Power Query, add index column:

vzhangti_0-1684376502899.png

Column:

Count = CALCULATE(COUNT('Table'[Month]),FILTER('Table',[Index]<=EARLIER('Table'[Index])&&[Month]=EARLIER('Table'[Month])))
Date = DATEVALUE(2023-[Count]&"/"&'Table'[Month]&"/"&"1")
Sort = YEAR([Date])*100+MONTH([Date])

vzhangti_1-1684377353734.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

1 REPLY 1
v-zhangti
Community Support
Community Support

Hi, @abelbb 

 

You can try the following methods. In the Power Query, add index column:

vzhangti_0-1684376502899.png

Column:

Count = CALCULATE(COUNT('Table'[Month]),FILTER('Table',[Index]<=EARLIER('Table'[Index])&&[Month]=EARLIER('Table'[Month])))
Date = DATEVALUE(2023-[Count]&"/"&'Table'[Month]&"/"&"1")
Sort = YEAR([Date])*100+MONTH([Date])

vzhangti_1-1684377353734.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.