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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
U156531
Helper V
Helper V

Sorting dates in a slicer

I need to be able to sort these dates by month in the slicer. There is n't any column in the Sort By Column list that works to sort these.

 

U156531_0-1727453441438.png

 

7 REPLIES 7
AnkitaaMishra
Super User
Super User

Hi @U156531 , Hope you are doing well.
I tried to replicate your problem considering that you have a date column in your table, please write below DAX to create another column : 

AnkitaaMishra_0-1727454931889.png

Now select the "Month selection" column and use "Sorting" column to sort it as shown below : 

AnkitaaMishra_1-1727455005498.png

Output : 

AnkitaaMishra_2-1727455088013.png

 

if this helps please mark it as the solution else provide additional details for your problem.

 

Thanks,

Ankita

 

 

I'm getting this syntax error trying to create the new calculated column

U156531_1-1727457208255.png

My year calcualted column is 

U156531_2-1727457257447.png

 

@U156531 please write below formula : 

Sorting =
VAR DateYear = VALUE(LEFT('Date'[Year], 4))
VAR DateMonth = MONTH(DATEVALUE('Date'[Month Number] & " 1"))
RETURN DateYear * 100 + DateMonth

Please replace the table and column name according to your table. 

You are getting an error because you are creating a VARIABLE but not returning the output.
 
 

That fixed the error in the calculated column.

I'm sorting the MTD by the new calculated column Sorting.

Unfortunately it didn't seem to sort it correctly.

U156531_1-1727460586555.png

my calendar table is below

U156531_2-1727460648015.png

 

Hi @U156531, AnkitaaMishra and Selva-Salimi, thank you for your prompt reply!

 

From your screenshot, the new column is of Text type, please change to the whole number, then sort the MTD again.

 

Best regards,

Joyce

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

U156531
Helper V
Helper V

Its a text field and I can't convert it to Date without getting this error below. Here is whats in the field.

U156531_0-1727454941245.png

 

Selva-Salimi
Super User
Super User

Hi @U156531 

 

Is your column in date format? I think not because if it was in Date format you can easily sort it.

 

If this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly. 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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