Forum Discussion
Feature Request: Matrix Visual
- 6 months ago
Regarding the second feature, "Per-Value-Column Sorting with Calculation Items"
I would like to suggest a workaround
I have a Matrix visual with the “Continent” column placed in the Rows well, the “Time Calc” column (in this scenario column is taken from a calculation group table, however same workaround can be used even when the column is taken from a normal table) placed in the Columns well, and “Sales Amount” placed in the Values well, as shown below.
I wanted to sort the Continents based on the QTD value in descending order.
By default, the Matrix visual does not support per-value sorting. In this scenario, you can follow the trick below to achieve this.
- Create a a new DAX measure
SortingMeasure =
Var __CYRank = RANK(DENSE, ALLSELECTED(Customer[Continent]), ORDERBY(Sales[Sales Amount],DESC))
Var __CalcItem = SELECTEDVALUE('Time Intelligence'[Ordinal],0)
Var __ReturnOnlyIfCY = IF(__CalcItem = 3, __CYRank) // For QTD the ordinal value is 3
Return __ReturnOnlyIfCY - Add this measure to the Matrix Values well
- Sort the Matrix visual based on SortingMeasure.
- Once the desired sorting is achieved, it is very important to hide the sorting measure from the Matrix.
- Change the format string of SortingMeausre to Dynamic and use the following expression:
UNICHAR(127)
This hides the value of the sorting measure.
6. At the visual level, rename SortingMeasure, Sales Amount, and Continentto a blank space, and rename the Time Calc column to “Continent”.
That’s it! You are now able to perform per-value sorting in a Matrix visual.
Connect on LinkedIn
you can read my blogs here: https://techietips.co.in
Did I answer your question? Mark my post as a solution! If I helped you, click on the Thumbs Up to give Kudos.
Proud to be a Super User!
- Create a a new DAX measure
Hi bradbel
Total Row at Top - Totals can only appear at the bottom. So, workaround is we can create a measure card or table visual above the matrix to show totals.
Sorting by Calculation Items - Power BI cannot sort matrix columns created from calculation groups individually. Sorting only works based on underlying measure. Workaround is creating measures instead of calculation items, or using a column for the sorting.
Both are current limitations of Power BI Matrix visuals and there is no native solution yet and only workarounds.