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

Month Sort with Most Current Month on the right in visuals

Within my Date Table I want to build a sort that will allow my visuals to keep the most current month to the furthest right. I have a Timestamp within my model so I was thinking the formula would start with something like:

IF( Month([Date]) = Month('Timestamp') , 12 ,

Sorting Example. If the current Month was May the Sort would go as follows:

January = 8

February = 9

March = 10

April = 11

May = 12

June = 1

July = 2

August = 3

September = 4

October = 5

November = 6

December = 7

 

Thank you!

1 ACCEPTED SOLUTION
sturlaws
Resident Rockstar
Resident Rockstar

hi, @PowerBIUser23

could you try to create this calculated column, and sort month name by this column:

shiftingMonthSort =
VAR _currentMonthNum =
    MONTH ( TODAY () )
VAR _month =
    MONTH ( Dates[Date] )
RETURN
    IF (
        _month <= _currentMonthNum,
        12 - _currentMonthNum + _month,
        ( _currentMonthNum - _month ) * -1
    )

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

View solution in original post

2 REPLIES 2
PowerBIUser23
Frequent Visitor

This worked perfect Thank you!

sturlaws
Resident Rockstar
Resident Rockstar

hi, @PowerBIUser23

could you try to create this calculated column, and sort month name by this column:

shiftingMonthSort =
VAR _currentMonthNum =
    MONTH ( TODAY () )
VAR _month =
    MONTH ( Dates[Date] )
RETURN
    IF (
        _month <= _currentMonthNum,
        12 - _currentMonthNum + _month,
        ( _currentMonthNum - _month ) * -1
    )

 

Cheers,
Sturla

If this post helps, then please consider Accepting it as the solution. Kudos are nice too.

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.