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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
gili_koren35
Regular Visitor

Sort month name by month number column not working

I created a month number column based on a date column.
I then created a month name column using a switch function based on the month number column.
But when I want to sort the month name column by the month number column I get the following error:

 

gili_koren35_0-1719504255190.png

 

I checked using DISTINCTCOUNT and for every month number there is one month name, and vice versa, so that's not the problem.
what can I do?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gili_koren35 

 

Can you show how your month number column and month name column look like currently? 

 

Anyway you can refer to the following blog to create the month number column and month name column from the date column directly with FORMAT function. If the table has dates of multiple years, formatting them into a YearMonth format will be better, otherwise you may experience the same error. 

Generate Year and Month Combinations in Power BI Report using DAX - RADACAD

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @gili_koren35 

 

Can you show how your month number column and month name column look like currently? 

 

Anyway you can refer to the following blog to create the month number column and month name column from the date column directly with FORMAT function. If the table has dates of multiple years, formatting them into a YearMonth format will be better, otherwise you may experience the same error. 

Generate Year and Month Combinations in Power BI Report using DAX - RADACAD

 

Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!

Arul
Super User
Super User

@gili_koren35 ,

Check that the month number column has unique values for each month. If there are duplicate month numbers for different months, Power BI will not be able to sort the months correctly.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.