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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
genashpuryk
Frequent Visitor

Month sorting within slicer

Hi everyone! I encountered a sorting problem, which is slightly different from the ones I found solved.

I have a custom table with Month list in a correct order:

genashpuryk_0-1712236617932.png

When I use this column as a slicer, months are sorted in an alphabetic order: 

genashpuryk_1-1712236700778.png

Is it possible to list them from Jan to Dec? I have seen a couple of solutions, using ranking or custom sorting, but I can't find a way to add this type of column to my month table. Any help would be valuable. Thanks in advance!

1 ACCEPTED SOLUTION
Joe_Barry
Responsive Resident
Responsive Resident

Hi @genashpuryk 

 

You need a sort column, so Jan = 1, Feb = 2 etc...

 

In Power Query add a custom column

 

if [Month] = "January" then 1 else 

if [Month] = "February" then 2 else 

if [Month] = "March" then 3 else 

if [Month] = "April" then 4 else 

if [Month] = "May" then 5 else 

if [Month] = "June" then 6 else 

if [Month] = "July" then  7 else 

if [Month] = "August" then 8 else 

if [Month] = "September" then 9 else 

if [Month] = "October" then 10 else 

if [Month] = "November" then 11 else 

if [Month] = "December" then 12 else  0

 

 

Load your table and go to table view, highlight the Month column and in the ribbion, click on sort by and choose the new column you created.

 

Thanks

Joe

 

If you found my answer helpful and it solved your issue, please accept as solution

 

View solution in original post

4 REPLIES 4
Joe_Barry
Responsive Resident
Responsive Resident

I honestly haven't seen that error in such a case before. Are you using the most recent version of Power BI? I heard that there are some issues with this version. Have you tried to close the popup and check the visual?

No, my version is a bit older. I decided to put ranks in a slicer box, using 1-2-3 instead of Jan-Feb-Mar, so your solution works perfectly for me. Thank you again! Have a nice day. 

Joe_Barry
Responsive Resident
Responsive Resident

Hi @genashpuryk 

 

You need a sort column, so Jan = 1, Feb = 2 etc...

 

In Power Query add a custom column

 

if [Month] = "January" then 1 else 

if [Month] = "February" then 2 else 

if [Month] = "March" then 3 else 

if [Month] = "April" then 4 else 

if [Month] = "May" then 5 else 

if [Month] = "June" then 6 else 

if [Month] = "July" then  7 else 

if [Month] = "August" then 8 else 

if [Month] = "September" then 9 else 

if [Month] = "October" then 10 else 

if [Month] = "November" then 11 else 

if [Month] = "December" then 12 else  0

 

 

Load your table and go to table view, highlight the Month column and in the ribbion, click on sort by and choose the new column you created.

 

Thanks

Joe

 

If you found my answer helpful and it solved your issue, please accept as solution

 

Hello, Joe! Your solution seem to work except for one error I get when sorting by new column: 

genashpuryk_0-1712237879988.png

 

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.