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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power BI Desktop sorts months in a wrong order when visualizing in a report

Hey guys,

 

I just uploaded data into Power BI Desktop via an excel file. Everything looks good. Everything is sorted by Month starting in April. In the data view it shows correct, in the visualization in the report the order ist totally wrong. I tried everything but couldn't figure out where the problem lies.

 

Thanks in advance

1 ACCEPTED SOLUTION

@Anonymous ,
You can accomplish the correct sorting by creating a sort table:
sample-01.png
Then build a relationship between the two tables and use the Month field from your new table instead. Then you can sort it ascending by your new month field.

In addition, if you have a date table with a date, I would suggest building a column for your year + monthnumber and sort your Month Name + Year by that.

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

4 REPLIES 4
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could refer to the following DAX:

Month Num =
SWITCH (
    'Table 2'[Month],
    "January", 1,
    "February", 2,
    "March", 3,
    "April", 4,
    "May", 5,
    "June", 6,
    "July", 7,
    "August", 8,
    "September", 9,
    "October", 10,
    "November", 11,
    "December", 12
)

If you have a detail date column, you could use MONTH() function to get month number.

Then you could get a correct order with these numbers.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Anonymous
Not applicable

What about the sort order being returned is incorrect? Incomplete? Is it retunring 1, 10, 11, 12, 2, etc? Tough to say without seeing more of your current configuration but assuming your date field is in the correct format, I would start by ensuring you have the specific visual in question sorting correctly..

 

Click the ellipsis at top right of your visual, check that "Sort by" is set to your date and in the correct direction.

Anonymous
Not applicable

Hey, 

 

I can't really see any order in the wrong display months. I selected the visual to be sorted by Month, but, it just doesn

t use the order how it is in the data view. For ex. right now it is using April, August, December, February, January ... makes no sense at all, it's doing alphabetical, but it should just leave the order how it is in the data view. 😞

@Anonymous ,
You can accomplish the correct sorting by creating a sort table:
sample-01.png
Then build a relationship between the two tables and use the Month field from your new table instead. Then you can sort it ascending by your new month field.

In addition, if you have a date table with a date, I would suggest building a column for your year + monthnumber and sort your Month Name + Year by that.

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.