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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
tuncay
Helper III
Helper III

Sort the visualization by month

I have a big list of data, where I have specific data sort by month about an organizational unit. When I create a visual, I try to sort the column month by monthNum, but it says: 

The Month column cannot be sorted by MonthNum. There cannot be more than one value for the same value in Month.

 

Since I have a list, where the months are listed in one column (type: text), it doesn't work. Is there any solution for this?

 

I would try changing the type of Month to date, but I have also a rows in that "Month" column like YTD, or ACT YTD PY. Need ur help, thanks.

 

month.PNG

1 ACCEPTED SOLUTION
FarhanAhmed
Community Champion
Community Champion

This is because your MonthNum has different values for Same Month 

 

e.g. Jan has 169,183,197 etc causing issues while sorting

 

to make this work your each text value must have the same Numeric value for sorting.

 

Try create a calculated column to give you values 

 

- Jan =1

- Feb =2 

 and so on.

 

Then apply sort by option and it will work for you.

 

Note: This calculated column should be done in Power Query or in Data Source.







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

Proud to be a Super User!




View solution in original post

7 REPLIES 7
FarhanAhmed
Community Champion
Community Champion

This is because your MonthNum has different values for Same Month 

 

e.g. Jan has 169,183,197 etc causing issues while sorting

 

to make this work your each text value must have the same Numeric value for sorting.

 

Try create a calculated column to give you values 

 

- Jan =1

- Feb =2 

 and so on.

 

Then apply sort by option and it will work for you.

 

Note: This calculated column should be done in Power Query or in Data Source.







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

Proud to be a Super User!




I tried this:

 

Spoiler

if [Month] = "ACT YTD PY" then 1
else if [Month] = "Jan" then 2
else if [Month] = "Feb" then 3
else if [Month] = "Mar" then 4
else if [Month] = "Apr" then 5
else if [Month] = "May" then 6
else if [Month] = "Jun" then 7
else if [Month] = "Jul" then 8
else if [Month] = "Aug" then 9
else if [Month] = "Sep" then 10
else if [Month] = "Oct" then 11
else if [Month] = "Nov" then 12
else if [Month] = "Dec" then 13
else if [Month] = "YTD" then 14

else 15

But it only shows me 1, 15 and 14. It doesn't work so well. Why?

This should work.

 

Make sure that you don't have any trailing or leading spaces in your data.

Try Trim before applying this step.







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

Proud to be a Super User!




Trimmed month column. Still showing the numbers: 15, 14, 1 only 😞

is it possible for you to share the PBIX file after removing sensitive data







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

Proud to be a Super User!




Unfortunately, this is not possible. Maybe I could try doing something else. Any ideas?

 

monthq.PNG

 

edit: I had to add a blank space after the values 😄 (e. g.: "Jan ") works now, thank you

See this file helps.

 

Also make sure that Trim, Clean is being applied also check the case sensitivity of the data itself while comparing.

 

if possible kindly share the screenshot of the calculated column like below

 

FarhanAhmed_0-1630912726450.png

 







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

Proud to be a Super User!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.