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.
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?
Solved! Go to Solution.
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.
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]
)
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.
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.
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]
)
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 😁
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |