Forum Discussion
Sorting matrix values
- 7 years ago
Hi jdbuchanan71,
first of all thanks for your quick reply.
Unfortunately I don't get some points of your solution. Below I attach a Dropbox link to the PBIX I used for some tests, would you be so kind to help me showing me how it goes?
Thanks!
Luca
Hello lucadiielsi ,
The only way I could find to do this is pretty ugly.
1. Add a table with the month names that is NOT connected to the date table. This is just for the users to select the 'Sort by' month.
Months = SUMMARIZECOLUMNS('Date'[Month],'Date'[Month Number])You can set the sorting on the new Months table to sort the month column on the month number column.
Then you add a measure that reads the selected month and only returns your value for that month or the total if no month is selected.
Sort Measure = VAR SelectedMonth = SELECTEDVALUE(Months[Month]) RETURN IF ( ISBLANK(SelectedMonth), [Sales Amount], CALCULATE([Sales Amount],FILTER( 'Date', 'Date'[Month] = SelectedMonth ) ) )
Add a drop down of the months from the table you created, this is for the users to pick the sort order.
Then you add the sort measure to your matrix and this is where it gets really ugly. It will add the sort measure under every month, even if you pick a sort month, all but one months of values will be blank but the space will still be there. You just have to set all the column widths for the sort measure month to 0. Then you set the sort on the matrix to the sort measure.
Hi jdbuchanan71,
first of all thanks for your quick reply.
Unfortunately I don't get some points of your solution. Below I attach a Dropbox link to the PBIX I used for some tests, would you be so kind to help me showing me how it goes?
Thanks!
Luca
- jdbuchanan717 years agoSuper User
Hello lucadiielsi
Here is an updated copy of the file with the date table and sorting measure.
- lucadiielsi7 years agoFrequent Visitor
Not super stylish, but working! :-)
Thanks!Luca