In this article, we will explain how to display and sort a Slicer Control by month or quarter name in PowerBI. Slicer is a powerful alternative way to filter the dataset shown on the page.
Scenario
In PowerBI, when you try to use the slicer to filter by a date field, it shows the year of this date field by default.
Unfortunately, there is no OOTB setting to change the Slicer behavior to display it as Month or Quarter name directly, instead of the year.
Steps to display the Slicer by month name
In this section, we will see how to show the Slicer by Month Name. Just do the following.
- At Home tab, specifically in Calculation Group, click on New Measure > New Column.
- Set the column name to “MonthName” or as you prefer.
- Type the column formula, by typing the date field name followed by a dot, then select “Month”.
- In Visualization Pane, drag and drop a Slicer and make sure it is selected.
- In Field section, drag the newly created column “MonthName” to the Field section in the Visualization Pane.
- The Slicer should now be shown by Month Name instead of the year's.
Sort the Slicer by Month NameAlthough the Slicer is displayed by Month name, it’s not sorted properly!
To sort a Slicer by Month Name, you should do the following.
- At Home tab, specifically in Calculation Group, click on New Measure > New Column.
- Set the column name to “MonthNumber” or as you prefer.
- Type the column formula, by typing the date field name followed by a dot, then select “MonthNo“.
- In Fields Pane, click on the “MonthName” Column to be selected.
- From the above ribbon, at Modeling tab, click on “Sort By Column” and select the newly created column “MonthNumber”.
- The Slicer should now be shown by Month Name and sorted properly.
Display and sort a Slicer by Quarter NameIn this section, we will see how to display and sort a Slicer by “Quarter Name”. It’s the same above steps but we will change Month to Quarter.
- At Home tab, specifically in Calculation Group, Click on New Measure > New Column.
- Set the column name to “QuarterName” or as you prefer.
- Type the column formula, by typing the date field name followed by a dot, then select “Quarter”.
- In Visualization Pane, drag and drop, a Slicer, and make sure it selected.
- In Field section, drag the newly created column “QuarterName” to the Field section in the Visualization Pane.
- The Slicer should be now shown by Quarter Name instead of year.
By the way, there is no need to create an additional column for “Quarter Number”; the Quarter Name column is by default sorted properly.
Conclusion
In this article, we have explained how to display and sort a Slicer control by Month or Quarter Name in Power BI.
Reference