Forum Discussion
Can I sort matrix visual based off a specific column?
Let's say I have table like this:
| Country | C1 | C2 | C3 |
| Product | Sales | Sales | Sales |
| P1 | 10 | 20 | 50 |
| P2 | 30 | 10 | 60 |
| P3 | 50 | 0 | 10 |
Product is the rows in the matrix, Country is in the columns and Sales is the measure in the values.
I want to sort let's say sort by Sales ascending in country C2, so I would get something like this:
| Country | C1 | C2 | C3 |
| Product | Sales | Sales | Sales |
| P3 | 50 | 0 | 10 |
| P2 | 30 | 10 | 60 |
| P1 | 10 | 20 | 50 |
I want to do it by specific column like this.
I showed that in my measure, with ISINSCOPE.
7 Replies
- lbendlinSuper User
Yes, change the column total to only include C2.
Measure = if(ISINSCOPE('Table'[Country]),sum('Table'[Sales]),CALCULATE(sum('Table'[Sales]),'Table'[Country]="C2"))Sort by the column total.
Hide the column total.
- afaroHelper III
I want to have the option to change by any country whenever I want instead of keeping static just for C2. So, if I want to do by C1 and C3, then end user should be able to do that.
To add, I don't want to create a measure where I remove the columns from matrix and explicitly add the country in the measure for example CALCULATE([Sales], Country = "C2") and so on. This is a solution but not something I am looking for since I prefer having to keep the columns.- lbendlinSuper User
Sure, have a disconnected slicer for the country selection and in the measure read the current slicer value.