Forum Discussion
Filter by different column depending on user selection
- Anonymous8 years ago
HI Mahonia,
You can refer to below steps to achieve your requirement.
1. Add a selector table as the source of slicer.
Selector = DATATABLE("Select",string,{{"OptionA"},{"OptionB"},{"OptionC"}})2. Add a measure to get the value of selected option.
Tag = IF ( SWITCH ( SELECTEDVALUE ( Selector[Select] ), "OptionA", LASTNONBLANK ( 'SampleData'[OptionA], [OptionA] ), "OptionB", LASTNONBLANK ( 'SampleData'[OptionB], [OptionB] ), "OptionC", LASTNONBLANK ( 'SampleData'[OptionC], [OptionC] ) ), "Y", "N" )3. Add visual level filter on above measure to filter tag "Y" records.
Result:
Regards,
Xiaoxin Sheng
HI Mahonia,
You can refer to below steps to achieve your requirement.
1. Add a selector table as the source of slicer.
Selector = DATATABLE("Select",string,{{"OptionA"},{"OptionB"},{"OptionC"}})
2. Add a measure to get the value of selected option.
Tag =
IF (
SWITCH (
SELECTEDVALUE ( Selector[Select] ),
"OptionA", LASTNONBLANK ( 'SampleData'[OptionA], [OptionA] ),
"OptionB", LASTNONBLANK ( 'SampleData'[OptionB], [OptionB] ),
"OptionC", LASTNONBLANK ( 'SampleData'[OptionC], [OptionC] )
),
"Y",
"N"
)
3. Add visual level filter on above measure to filter tag "Y" records.
Result:
Regards,
Xiaoxin Sheng
Hi Anonymous, thank you very much for this, this works perfectly as long as the visualisation has this dimension included.
However, if I want to do a Distinct Count of members of the dimension, the filter on the Tag measure does not work, because it evaluates at the top level. Do you know of any way around this?
- Anonymous8 years agoNot applicable
Hi Mahonia,
For your scenario, I'd like to suggest you to use RLS on to apply the filter effect on top level.
You can refer to below links to know more about RLS:Power BI – Dynamic Row Level Security – Tips to get it working!
Tutorial: Dynamic row level security with Analysis services tabular model
Regards,
Xiaoxin Sheng