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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Filipe89
Frequent Visitor

Order matrix collum month year

Filipe89_0-1682084241865.png

Im having another struggle, i want do order this collums of the matrix from 2023-04,  2023-03, 2023-02 ,so on, i tried by query, the near i got was as the image. 

i have a collum named YearMonth, it is data type, and has YYYY-MM structure. So far i created a new collum name TYPE year to show me just the year, and then created a new collum to passed the values to negative 

Column = Year('Sold'[TYPE YEAR])*-1, than sorted YearMonth collum by it. 
 
any ideia on how to do it? 
1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

You can add a new column to your date table with an expression like this

MonthsFromNowReverse = DATEDIFF([Date], TODAY(), MONTH)
 
and then use it as the Sort By column for your YYYY-MM column

ppm1_0-1682167703405.png

 

Pat

Microsoft Employee

View solution in original post

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

You can add a new column to your date table with an expression like this

MonthsFromNowReverse = DATEDIFF([Date], TODAY(), MONTH)
 
and then use it as the Sort By column for your YYYY-MM column

ppm1_0-1682167703405.png

 

Pat

Microsoft Employee
Filipe89
Frequent Visitor

Thank you,

Just need to create one more column so that this solution could work. If i didnt it would give me an error that it was sorting by ir self.

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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