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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
krist_pbi
Regular Visitor

Order axis for matrix visual

Hi community,

 

I need help with the following, is there a way I can sort the column axis (dates) from oldest to newest but from left to right? It doesn't let me do it, I have a client that doesn't want to scroll right until the most recent week and it makes sense

 

Thanks
Screenshot 2022-09-19 184200.png

5 REPLIES 5
HoangHugo
Solution Specialist
Solution Specialist

Hi, you can create an extra column to rankx your date in order of Asscending

 

 extra column = RANKX(your table, date column,,1)
then you sort your date colum by extra column, an the matrix will show expected result.

StefanoGrimaldi
Resident Rockstar
Resident Rockstar

you need to sort the column in the data table itself first, the visuals take the order set upon the table first by default, theres a pane on the top of power bi desktop that lets you sort a column by givin condition or another column 

StefanoGrimaldi_0-1663637218415.png

 





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




danextian
Super User
Super User

Hi @krist_pbi ,

 

I tested that myself. There is no option to sort the column in a matrix unless it is sorted by  another column. So the workaround is to create a date calc column in DAX or duplicate it in PQ and then use RANKX to create a sort by column.

See sample formulas and the screenshot below

Date2 =
 'DataTable'[Date]
DateRank =
RANKX ( VALUES ( 'DataTable'[Date] ), 'DataTable'[Date],, DESC )

danextian_0-1663637095197.png

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you, just one question, the formula you shared then has to be created as a calculated column in my Calendar table, correct? Then just sort the weeks by this column, correct?

DateRank =
RANKX ( VALUES ( 'DataTable'[Date] ), 'DataTable'[Date],, DESC )

 

you will do need the extra colum, you can create a column as year&month to use that as sort column for the main dat ecolumn and so it will work around it also you can try creating a calendar using a tool bravo its pretty good and efficient for createing this type of dimensional tables and other stuff: 

StefanoGrimaldi_0-1663759122799.png

 





Did I answer your question? Mark my post as a solution! / Did it help? Give some Kudos!

Proud to be a Super User!




Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.