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
vgt56gyr2
Frequent Visitor

dynamic custom sort on month

Hi,

Problem: trying to get the x-axis column chart to dynamically sort on user selection based on date slicer --> mat, fiscal year, production year, budget... there are other periods...

As of Feb, we have moving annual total (mat) months order --> rolling window Feb-Jan, next month will be Mar-Feb etc...

Month_MAT_Order123456789101112
Month_Num234567891011121

 

fiscal year July-June

Month_FY_Order789101112123456
Month_Num123456789101112

 

production year April-March

Month_PY_Order101112123456789
Month_Num123456789101112

 

cannot use sort by column (or can we call it by code?) using this code as it doesnt change the salesdata dynamically by filter/slicer, how can the axis be sorted in the correct order by user selection? Looks like it cant be done?

 

 

 

Month_Order =
var DateSlicer = SELECTEDVALUE(Date_Slicer_Compare_Periods[Current])

return
switch(true(),
DateSlicer="12 Months (MAT)",item_sales[MAT_Month_Order],
DateSlicer="6 Months (MAT)",item_sales[MAT_Month_Order],
DateSlicer="3 Months (MAT)",item_sales[MAT_Month_Order],
DateSlicer="Fiscal Year to date",item_sales[FY_Month_Order],
1
)

 

 

 

 

 

vgt56gyr2_0-1676936494141.png

 

vgt56gyr2_1-1676936611564.png

 

 
1 ACCEPTED SOLUTION

use the rankx measure for each sort order column:

How to sort by multiple columns in Power BI [Table Visual Examples] - SPGuides

 

but unfortunately we still cant hide columns in the chart! lol, have to use formatting 😞

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Hi, it doesn't really answer my question.

I already have a sort order column for these custom periods.

how can the axis be sorted in the correct order by user selection? 

Did you ever find a solution to your question?

use the rankx measure for each sort order column:

How to sort by multiple columns in Power BI [Table Visual Examples] - SPGuides

 

but unfortunately we still cant hide columns in the chart! lol, have to use formatting 😞

no, but would like to.

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.