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
jagostinhoCT
Post Partisan
Post Partisan

sort months using calendar data source column

Hello,

 

I have found some posts referencing to this issue but could not find anything that could help me figuring out why it is not working.

 

I have this graph, below, which I want to show chronologically. All is well for all other months, but "November" actually belongs to 2015 so I would like it to move to the left.

 

 

Picture1.png

 

 

 

 

 

 

 

 

 

 

 

 

Picture2.png

 

 

 

 

Now, I am using a "Date" column for the X axis, from a Calendar Datasource. And I have chosen to sort it by the "DateInt" column, which formats the date into YYYYMMDD.

Picture3.png

Picture4.png

Picture5.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Shouldn't this result on "November" being sorted as the first one of the X axis?

 

Many thanks for your time and help.

Kind regards,

J

1 ACCEPTED SOLUTION

@jagostinhoCT My suggestion "explicitly" defines the columns and uses for them. The date hierarchy default "implicitly" handles the conversion. Your current INT column won't work sorting against a YearMonth because it is more granular. (you'll get an error).

You need to add both these columns to your calendar table.

YearMonth for display

YearMonthNumber for sorting the YearMonth display column.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

4 REPLIES 4

@jagostinhoCT I see your point with the assumption that the defaulted hierarchy provided would sort all dates by your sort column, but obviously something is getting lost in translation. Which isn't suprising, given that you need sort columns in your date table depending on how you want to display things.

For example. To show the appropriate Monthname order you need an INT 1-12 MonthNumber, you can directly solve your issue by adding a YearMonth column and adding a sort INT column with YearMonthNumber (example: 201608 would be August of this year). This would give you the expected result, and also identify to the end user that you are looking at two different years.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

Hi @Seth_C_Bauer

 

Thank you for the reply.

 

But do I not already have that column? the INT? using the correct format?

 

Just to clarify, in which table do I need to add the YearMonth column you mentioned?

And where do I add the sort INT column with YearMonthNumber that you also mentioned after that?

 

It is still a little confusing for me. My apologies.

 

Thank you.
J

@jagostinhoCT My suggestion "explicitly" defines the columns and uses for them. The date hierarchy default "implicitly" handles the conversion. Your current INT column won't work sorting against a YearMonth because it is more granular. (you'll get an error).

You need to add both these columns to your calendar table.

YearMonth for display

YearMonthNumber for sorting the YearMonth display column.


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

That;s exactly it.

 

Thank you for your time and patience.

 

Kind regards,

Joaquim

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.