Power BI Blog: Ordering Slicer Selections on Cards
1 October 2020
Welcome back to this week’s edition of the Power BI blog series. This week, Jonathan Liau looks at how to order slicer selections that are displayed in a card in Power BI.
This week we are going to pick up where we left off two weeks ago. As a recap, we created a measure that can display multiple countries on a card based upon slicer selection:
List of Countries =
The measure returns with the following results when displayed on a card visualisation:
Taking a closer look at our title card, ‘Germany, France, United Kingdom’ doesn’t seem to be displayed in any particular order.
What if we want to order the countries by alphabetical order?
The CONCATENATEX function actually accepts order parameters:
CONCATENATEX(table, expression, [delimiter], [OrderBy_Expression1], [Order1], …)
Let me explain the parameters:
- The OrderBy_Expression1 parameter is optional, but it is the field or expression used to order the table
- The Order1 parameter accepts either ASC or DESC, for ascending or descending, respectively.
Now with the fourth and fifth parameters in mind, we can make the following adjustments to the measure:
List of countries alphabetical =
In the new measure, we have placed Geography[Country] as the OrderBy_Expression1, which means we want to order the results by that field. We then have ASC as the Order1 parameter, which means that we want the countries to be order in ascending order.
As you can see, the countries are now order in alphabetical order.
We can even order the countries by an expression, let’s try ordering them by the [Total Sales]
List of countries ordered by total sales =
That’s it for this week! Come back next week for more on Power BI!