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
shekhar_shres
Helper II
Helper II

Return Blank Value if a Slicer is selected

Hi everyone,

I hope you are all doing great. I want to make a Measure goes blank if a slicer is selected but I am only half way there. 

I have dimRegion Table as below:
RegionState RegionState ID

RegionState ID
Region AA1
Region BB1
Region CC1
Region XX2
Region YY2
Region ZZ2

 

And I have StateTable which is connected to Region Table above with State ID

StateIDState
1VIC
2NSW


Also, I have as staff cost table (factTable) as below.

StateIDMetricAmount
1Staff Cost500

 

The problem is Staff Cost is allocated on State Level and not the Region Level. So, I want to make sure that my measure
(StaffCost = sum(StaffCost[Amount]) )goes blank or 0 when someone selected Region Slicer in Power BI.

I tried using following dax

StaffCostDynamic = IF(HASONEVALUE(dimRegion[Region]),blank(), [StaffCost]))

So far, the above dax works if someone selects only one Region (Say Region AA) in the slicer. but as soon as someone selects two Region in the Slicer (Say Region AA and Region BB) then the actual value appears (In our example $500). 

What dax should I write to ensure that the StaffCostDynamic Measure goes blank when someone selected Region Slicer. 


Your help will be highly appreciated. 

Kind regards,






1 ACCEPTED SOLUTION
vicky_
Super User
Super User

You could try using ISFILTERED(dimRegion[Region]) instead of HASONEVALUE() in your if statement.

View solution in original post

2 REPLIES 2
vicky_
Super User
Super User

You could try using ISFILTERED(dimRegion[Region]) instead of HASONEVALUE() in your if statement.

Exactly what I needed.


Thank you

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.