Forum Discussion
How could implement selecting columns which shows in table dynamically?
- 6 years ago
Anonymous It is a bit unconventional but you can try to unpivot all the A and M columns, so that you are left with:
C, Attribute, Value
Also create a disconnected table (no relationships to current data model) for the M values that you want user to select. I called this table Slicer.
Slicer:
Select M1 M2 M3 Then create the matrix with C in Rows, Attribute in Columns, Value in Values.
Finally, create this measure to filter the Attribute:
ShowColumns =Var SlicerSelection = VALUES(Slicer[Select])Var AlwaysShow = {("A1"), ("A2"), ("A3")}Var ShowValues = UNION(SlicerSelection, AlwaysShow)RETURNIF(SELECTEDVALUE('Table'[Attribute]) IN ShowValues, 1, 0)Put a filter on the visual for Attribute using Top N and use the ShowColumns measure as the By Value to filter for Top 1.
Thanks v-lionel-msft ,the steps which you mentioned is what I did( as I explained before), but the result is not similar to what I want, I need the result as follow:
| C | A1 | A2 | A3 | M1 | M2 | M3 |
Regards,
Matin
Anonymous It is a bit unconventional but you can try to unpivot all the A and M columns, so that you are left with:
C, Attribute, Value
Also create a disconnected table (no relationships to current data model) for the M values that you want user to select. I called this table Slicer.
Slicer:
| Select |
| M1 |
| M2 |
| M3 |
Then create the matrix with C in Rows, Attribute in Columns, Value in Values.
Finally, create this measure to filter the Attribute: