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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Sort Month Year

Hello, Screenshot 2020-11-02 110600 - Invoice Aging .png

 

I am having trouble sorting the dates Below. I created an additional column based off our Ship date. The column I created is

 

YearMonth(Ship) = 'FBAP Event Detail Fact'[ship_dt].[Year]&"-"&'FBAP Event Detail Fact'[ship_dt].[Month]
 
How can I possibly sort the column below.
 
I tried using the formula below but I get a text error.
Sort_YearMonth(Ship) = 'FBAP Event Detail Fact'[ship_dt].[Year] * 100 + 'FBAP Event Detail Fact'[ship_dt].[Month]​
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi

 

Could I ask, have you attempted to sort by the visual and it has sorted them alphabetically.

 

If so, I would suggest using a data table, linking to the date in your table. You are able to create custom columns from this to display the date in your desired format I.e. 202010 or 2020 - April/ yyyy-mmm

 

https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi#:~:text=In%20your%20report%2C%20... 

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

You should ideally create a Calendar Table with Year and Month extracted via these calculated column formulas

Year = year(calendar[date])

Month name = format(calendar[date],"mmmm")

Month number = month(calendar[date])

Sort the Month name column by the month number column.  Ensure there is a relationship from the ship_dt column to the date column of the calendar table.  To the x-axis of your visual, drag Year and Month from the Calendar table.

Hope this helps. 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi

 

Could I ask, have you attempted to sort by the visual and it has sorted them alphabetically.

 

If so, I would suggest using a data table, linking to the date in your table. You are able to create custom columns from this to display the date in your desired format I.e. 202010 or 2020 - April/ yyyy-mmm

 

https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi#:~:text=In%20your%20report%2C%20... 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.