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
steambucky
Helper III
Helper III

X-Axis Sort by month AND year

I wanted to data as month and year. I followed these instuctionsin an old post:

 

Solution:

Add a Year Column: FieldYear = YEAR(Date)

Add MonthColumn:  FieldMonth =  MONTH(Date)

THEN ADD SORTORDER column using the two extra columns created above and in this order :  SortOrder =                     CONCATENATE(FieldYear,FieldMonth)

 

(found that solution here : Link)

 

That kind of works with ONE exception (see image )

 

Power BI Desktop - month issue.png

 

You can see where the month has is January ( represented by a 1 ) it is in the wrong month order.

 

The answe ( I think ) is to format the month number as 01 rather than 1.

 

Any idea How do you do this? Or is the more efficent way to do the entire thing?

 

Kind regards,

 

Steam Bucky

 

1 ACCEPTED SOLUTION
steambucky
Helper III
Helper III

I found the term i was looking for "Leading Zeros - you can add them by using this format funsction: FORMAT(Table[Col],"00")

 

This would make "1" into "01"

 

 

 

 

 

 

 

 

 

 

 

View solution in original post

1 REPLY 1
steambucky
Helper III
Helper III

I found the term i was looking for "Leading Zeros - you can add them by using this format funsction: FORMAT(Table[Col],"00")

 

This would make "1" into "01"

 

 

 

 

 

 

 

 

 

 

 

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.