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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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