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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.