Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
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:
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?
Solved! Go to Solution.
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!
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!
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.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.