Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Set measure value based on slicer selection

Good afternoon

 

I would be grateful for some help with the following issue.

I have 2 measures Cardcount and Cardpos, which I think I need to make act like two variables and I do not know how.

I need to set each measure to be a value of either "Higher" or "Lower", depending on what I select in a slicer.

I created a table that looks like this

FocusConvPosit
TSR IssueHigherLower
Overall EngagementLowerLower
TSR EngagementLowerHigher
All GoodHigherHigher

 

I created a slicer that uses the values in the Focus column. I created my first measure

FocSel = SELECTEDVALUE(tblFocus[Focus])
Now I want the measure CardCount to equal the value in tblfocus(Conv) and the measure cardpos to equal tblfocus(posit).
 
I then created this measure to try to set the value
Focal =
Switch(
True()
tblfocus[focsel] = "All Good",calculate([cardcount] = "Higher"),
tblfocus[focsel] = "All Good", calculate([cardpos] = "Higher")
etc
)
I tried to use the above as I was unable to make the measures set to the string value.
When I created the measures cardcount and cardpos I used the statement cardcount =""
 
I think i have gone wrong in 
1. I don't know how to use the slicer to set a variable
2. Setting the measure to "" keeps it at a null value
3. refer to point 1
 
I look forward to someone educating me on how to move this along. I am new to this and youtube tutorials are a little hit and miss. I appreciate any guidance.
 
Lola
 
 
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

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





Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

2 REPLIES 2
TomMartens
Super User
Super User

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





Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

@TomMartens 

 

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.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.