Forum Discussion
Order attributes
- 1 year ago
DATATABLE returns a table and not a column. You need to modify the table itself and not create a calculated column. Note: The code i gave you was just a sample which of course didn't include all attribute values.
Hi Msampedro
If I understood your goal correctly, you’re trying to assign a specific order to a set of attributes that will later be used as columns in a Matrix visual.
In order to apply a custom sort order to columns in a Matrix, you’ll need a physical sort column, which isn’t possible with a calculated measure or just a SWITCH expression alone.
You have two main options:
1. Create a disconnected table using "Enter Data"
Include the desired attribute values and a numeric column for the order (1, 2, 3…).
Then, use a SWITCH-based dynamic measure that returns the appropriate value based on the selected attribute.
2. Use Field Parameters (recommended if you're on a recent Power BI version)
Field Parameters allow you to define the attribute order directly, and the Matrix will reflect that order as you set it.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly