Forum Discussion
Set measure value based on slicer selection
- 3 years ago
Hey Anonymous ,
I have to admit that I do not fully understand what challenges you have to tackle.No matter, if you are using a slicer based on the column focus you can use this snippet to create two variables in every measure that you want to "react" on the slicer selection
some measure = var selectedConv = SELECTEDVALUE( 'Table'[Conv] , BLANK() ) //provide a default value or consider making the focus slider a single selection var selectedposit = SELECTEDVALUE( 'Table'[Posit] , BLANK() ) //provide a default value or consider making the focus slider a single selection return SWITCH( TRUE() , selectedConv = "Higher" && selectedposit = "Lower" , 1 //put you measure definiton here , selectedConv = "Higher" && selectedposit = "Higher" , 2 , selectedConv = "Lower" && selectedposit = "Higher" , 3 , selectedConv = "Lower" && selectedposit = "Lower" , 4 )You are not restricted to use SELECTEDVALUE with the column that is used on a slicer, the default value is fired when more than one value is selected inside the slicer or none (meaning all).
Hopefully, this provides an idea on how to tackle your challenge.
Regards,
Tom
Hey Anonymous ,
I have to admit that I do not fully understand what challenges you have to tackle.
No matter, if you are using a slicer based on the column focus you can use this snippet to create two variables in every measure that you want to "react" on the slicer selection
some measure =
var selectedConv = SELECTEDVALUE( 'Table'[Conv] , BLANK() ) //provide a default value or consider making the focus slider a single selection
var selectedposit = SELECTEDVALUE( 'Table'[Posit] , BLANK() ) //provide a default value or consider making the focus slider a single selection
return
SWITCH(
TRUE()
, selectedConv = "Higher" && selectedposit = "Lower"
, 1 //put you measure definiton here
, selectedConv = "Higher" && selectedposit = "Higher"
, 2
, selectedConv = "Lower" && selectedposit = "Higher"
, 3
, selectedConv = "Lower" && selectedposit = "Lower"
, 4
)
You are not restricted to use SELECTEDVALUE with the column that is used on a slicer, the default value is fired when more than one value is selected inside the slicer or none (meaning all).
Hopefully, this provides an idea on how to tackle your challenge.
Regards,
Tom
- Anonymous3 years agoNot applicable
Thank you so much for this. It was in the ballpark of what I required so I was able to adapt what you had and make it work. I really appreciate it, thank you for your time.