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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
shekhar_shres
Advocate II
Advocate 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
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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