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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
shaunguyver
Helper III
Helper III

IF statement based on filters

I have a slicer, which has 3 possible values, taken from 'Region' column in my data set.

 

  • USA
  • Europe
  • Asia

I have a card that has 'Region' as its value. Each time a region is selected in the slicer, it updates the card.

 

I want to create a measure that (logically) reads like this:

 

Measure = IF('Region'=Blank,"Global",'Region')

 

In other words, if the slicer containing 'Region' has nothing selected I want the measure to display the value 'Global'. Once a region is selected, the card displays the selected region.

 

Is this possible?

 

Thanks in advance

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

Try this, if one region selected, it will give the name of the region, if none is selected or more than one selected, it will say "Global"

 

You have to think what you want to say in case more than one region is selected , basically out of 3 you listed, user selects 2, what you want to call it, GLOBAL? I didn't consider that in  following DAX.

 

Measure Region = IF ( HASONEVALUE( Table[Region] ), VALUES( Table[Region]), "GLOBAL" ) 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

You can do this by using ISFILTERED Function

 

 

Dynamic Region Value = SWITCH(TRUE(), ISFILTERED(Sheet1[Region]),SELECTEDVALUE(Sheet1[Region]),
                             "Global"
)

OR Dynamic Region Value = IF(ISFILTERED(Sheet1[Region]),SELECTEDVALUE(Sheet1[Region]),"Global")

 

Challenge - Unselected Filter.PNG

parry2k
Super User
Super User

Try this, if one region selected, it will give the name of the region, if none is selected or more than one selected, it will say "Global"

 

You have to think what you want to say in case more than one region is selected , basically out of 3 you listed, user selects 2, what you want to call it, GLOBAL? I didn't consider that in  following DAX.

 

Measure Region = IF ( HASONEVALUE( Table[Region] ), VALUES( Table[Region]), "GLOBAL" ) 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors