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
Joncho_M
Regular Visitor

Months

I am trying to sort the months chronologically, but I don't have a calendar table or any other date column, just the months. How can I sort them correctly?

 

Joncho_M_1-1674846096773.png

 

1 ACCEPTED SOLUTION
v-stephen-msft
Community Support
Community Support

Hi @Joncho_M ,

 

You can create a calculated column to get the month number.

MonthNumber =
SWITCH (
    [MES],
    "Enero", 1,
    "Febrero", 2,
    "Marzo", 3,
    "Abril", 4,
    "Mayo", 5,
    "Junio", 6,
    "Julio", 7,
    "Agosto", 8,
    "Septiembre", 9,
    "Octubre", 10,
    "Noviembre", 11,
    "Diciembre", 12
)

Then in the table visual, put the new column into it and sort by MonthNumber.

vstephenmsft_0-1675059625033.png

Or you can create a calendar table and get the month name.

Since I'm the English version of Power BI Desktop, the month names are all in English.

And then sort the MonthName by the MonthNumber.

Calendar =
SUMMARIZE (
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2023, 1, 1 ), DATE ( 2023, 12, 31 ) ),
        "MonthNumber", MONTH ( [Date] ),
        "MonthName", FORMAT ( [Date], "MMMM" )
    ),
    [MonthName],
    [MonthNumber]
)

vstephenmsft_1-1675059926715.png

vstephenmsft_2-1675060022860.png

 

You can connect the calendar table to your table.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

View solution in original post

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @Joncho_M ,

 

You can create a calculated column to get the month number.

MonthNumber =
SWITCH (
    [MES],
    "Enero", 1,
    "Febrero", 2,
    "Marzo", 3,
    "Abril", 4,
    "Mayo", 5,
    "Junio", 6,
    "Julio", 7,
    "Agosto", 8,
    "Septiembre", 9,
    "Octubre", 10,
    "Noviembre", 11,
    "Diciembre", 12
)

Then in the table visual, put the new column into it and sort by MonthNumber.

vstephenmsft_0-1675059625033.png

Or you can create a calendar table and get the month name.

Since I'm the English version of Power BI Desktop, the month names are all in English.

And then sort the MonthName by the MonthNumber.

Calendar =
SUMMARIZE (
    ADDCOLUMNS (
        CALENDAR ( DATE ( 2023, 1, 1 ), DATE ( 2023, 12, 31 ) ),
        "MonthNumber", MONTH ( [Date] ),
        "MonthName", FORMAT ( [Date], "MMMM" )
    ),
    [MonthName],
    [MonthNumber]
)

vstephenmsft_1-1675059926715.png

vstephenmsft_2-1675060022860.png

 

You can connect the calendar table to your table.

 

                                                                                                                                                         

Best Regards,

Stephen Tao

 

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

Awesome! Thanks Stephen 😁

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.