Forum Discussion
grkm
9 months agoNew Member
Conditional Filtering Based on Slicer Selection
Hi Everyone! I have a slider(single selection) which shows city_name. Based on selection it shows branches. That's perfectly fine. I would like to add a "L Aggregate" into my slider as thitd opt...
- 9 months ago
Hi grkm , I have achieved your requirement using a measure and a calculated table to make it dynamic. Have attached the DAX and the file along with this reply. If you don't want to display the measure you can hide by shrinking that column in a table visual.
//Calculated Table Slicer Table = var AllCities = SELECTCOLUMNS('City Data',"city_id",'City Data'[city_id],"city_name",'City Data'[city_name]) var LAggregate = DATATABLE("city_id",INTEGER,"city_name",STRING,{{0,"L Aggregate"}}) RETURN UNION(AllCities,LAggregate)//Measure Measure = IF( SELECTEDVALUE('Slicer Table'[city_name]) = "L Aggregate" , CALCULATE(COUNT('Branch Data'[branch_id]),'Branch Data'[branch_size] = "L"), CALCULATE(COUNT('Branch Data'[branch_id]),TREATAS(VALUES('Slicer Table'[city_id]),'Branch Data'[city_id])))Thanks,
Jai Rathinavel
Jai-Rathinavel
9 months agoSuper User
Hi grkm , I have achieved your requirement using a measure and a calculated table to make it dynamic. Have attached the DAX and the file along with this reply. If you don't want to display the measure you can hide by shrinking that column in a table visual.
//Calculated Table
Slicer Table =
var AllCities = SELECTCOLUMNS('City Data',"city_id",'City Data'[city_id],"city_name",'City Data'[city_name])
var LAggregate = DATATABLE("city_id",INTEGER,"city_name",STRING,{{0,"L Aggregate"}})
RETURN
UNION(AllCities,LAggregate)
//Measure
Measure = IF(
SELECTEDVALUE('Slicer Table'[city_name]) = "L Aggregate" ,
CALCULATE(COUNT('Branch Data'[branch_id]),'Branch Data'[branch_size] = "L"),
CALCULATE(COUNT('Branch Data'[branch_id]),TREATAS(VALUES('Slicer Table'[city_id]),'Branch Data'[city_id])))
Thanks,
Jai Rathinavel
grkm
9 months agoNew Member
Jai-Rathinavel Thank you very much. Perfect 👍