Forum Discussion
Create a filter with custom string values
- 3 years ago
create a new table called 'Selection_Options' with a single column, 'Options', with no relationships to other tables.
Make the data in the Options column like this:
Model1
Model2
Model3etc.
Then, for each column you'll have in your table visual, you'll have a measure like this:Column_1_Switch =VAR Selection =SELECTEDVALUE('Selection_Options'[Options], "All")RETURNSWITCH(TRUE(),Selection = "Model1", [Expression1],Selection = "Model2", [Expression2],Selection = "Model3", [Expression3]--etc.)
Alright. NOW, lastly, add a slicer to the page with your 'Selection_Options'[Options] column, and go to Visualizations> Format Visual> Visual> Slicer Settings> Single Select and turn Single Select ON!
Now, depending on what is selected in your slicer, each column can display a totally different measure.
You may have to have the same number of lines in each switch statement, one for each model. But that doesn't mean you can't have it return BLANK() if you want one model to have 4 columns and the other to have 3 etc.
The caveat is the columns headers will be the SAME in each model. So you may want to look into another solution if that is unacceptable to you.
You can "technically" do something like this with a field parameter. When building a field parameter, you can only select columns once but after it's initially built you can add rows as you choose by following the syntax in the definition. In addition, you can add another column to each element with the model numbers. Then, you can use the field parameter object and use this new column with the models as your slicer to dynamically choose which columns you need displayed.