cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
steambucky Member
Member

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

Accepted Solutions
steambucky Member
Member

Re: X-Axis Sort by month AND year

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"

 

 

 

 

 

 

 

 

 

 

 

1 REPLY 1
steambucky Member
Member

Re: X-Axis Sort by month AND year

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"