Forum Discussion
Sorting a matrix with multiple measures by column
- 1 year ago
Hi DAX_merchant ,
Thanks for the update. Unfortunately, Power BI does not currently support fixed or persistent column widths in matrix visuals. The column width is automatically calculated based on the data in each column and is recalculated any time the visual is refreshed or slicers are changed. There is no built-in setting to lock or fix column widths.
I tried to recreate the issue on my end, and it worked fine. This behavior is likely unintended or a setting that hasn’t been fully integrated into Power BI Desktop yet.
If this feature is important to you, consider submitting a suggestion on Fabric Ideas or voting for an existing one.
https://community.fabric.microsoft.com/t5/Fabric-Ideas/idb-p/fbc_ideasIf this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.
Regards,
Chaithra.
In Power BI, you cannot directly extract the clicked column header from a matrix visual (since it doesn’t pass filter context like a slicer does).
Create a table that contains all the years in your dataset and you will use this as a single-select slicer so the user can choose a sorting year.
YearSelection = DISTINCT('YourDateTable'[Year])
Then you need a measure to extract the selected year from the slicer:
SelectedYear = SELECTEDVALUE(YearSelection[Year], YEAR(TODAY()))
And another measure for ranking based on the selected year based on total sales for the selected year :
RankByYear =
VAR _Year = [SelectedYear]
RETURN
RANKX(
ALLSELECTED('Stores'),
CALCULATE(SUM('Sales'[Total Sales]), 'Date'[Year] = _Year),
,
DESC,
DENSE
)
Another alternative is using Bookmarks & Buttons to simulate clicking on a year.
Unfortunate that you can't do that.
That solution I already implemented, but I guess it is not possible to elegantly overlay that slicer onto the column headers.
Thanks.