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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

IF STATEMENT USING SELECTED VALUE

Hi Guys,

 

Newbie here,

 

I would like to know if is it possible to use SELECTEDVALUE function in an IF STATEMENT as a measure.

 

For Example.

I want to use different MEASURE depending on the SELECTEDVALUE of a slicer.

 

Thank you so much for your help ! 🙂 

1 ACCEPTED SOLUTION
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

Yes, you can do that.  You'll probably want to use SWITCH though, to avoid lots of nested IFs.

Something like

Selected Measure = 
SWITCH(
    SELECTEDVALUE(Table[Slicer Column]),
    "Slicer Value 1", [Measure 1],
    "Slicer Value 2", [Measure 2],
    ..... etc
    )

View solution in original post

3 REPLIES 3
PaulOlding
Solution Sage
Solution Sage

Hi @Anonymous 

Yes, you can do that.  You'll probably want to use SWITCH though, to avoid lots of nested IFs.

Something like

Selected Measure = 
SWITCH(
    SELECTEDVALUE(Table[Slicer Column]),
    "Slicer Value 1", [Measure 1],
    "Slicer Value 2", [Measure 2],
    ..... etc
    )
Anonymous
Not applicable

Hi @PaulOlding ,

 

Thank you so much!

bcdobbs
Super User
Super User

You certainly can!

 

Have a look at this example:

https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?MessageKey=b52f0351-...



Ben Dobbs

LinkedIn | Twitter | Blog

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.