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
JustinDoh1
Post Prodigy
Post Prodigy

How to exclude certain value within Filter (illustrated on the bottom DAX)?

I have a Measure that has DAX code something like this:
 
Occupancy % Total Rest =
Divide(
    calculate(
            sum(tblTrend[Ave Census]),
            FILTER ( tblTrend, tblTrend[FacilityCode] in
               VALUES('tblKey'[FacilityCode])
                )
    ),  
    calculate(
            sum(tblOccupancy[Capacity]),
             FILTER ( tblTrend, tblTrend[FacilityCode] in
                 VALUES('tblKey'[FacilityCode]))
)
)
 
I would like to add more excluded value of something like tblKey'[FacilityCode] = " 61" to it or tblKey'[FacilityCode] = " 61" or "52"  along with VALUES('tblKey'[FacilityCode]) on certain Measures.
 
The reason that I am trying to do is, currently, this measure dynamically changes value by how user selects slicer called "Facility Name".
But, I would like to modify the calculation of this measure by adding another condition to exclude value(s).
 
In SQL, it would be like:
Where tblKey'[FacilityCode] not in ('61') or even like
Where tblKey'[FacilityCode] not in ('61', '52') on other future scenario where multiple values need to be excluded.
 
When I use slicer "Facility Name", and I want to show all Facilities (Valley, Ally, Jack) on rest of visuals, but I would like to apply this exclusion on only certain Measures.
 
How do I express that?
 
I have attached PBI file here for reference:
This particular CARD (that shows 91.9%) is the code (measure called "Occupancy % Total Rest") shown on the top.
 
JustinDoh1_1-1710397850490.png

So, in this case, instead of 91.9%, I would like to see 80.9% because FacilityCode of 61 (Jack) is excluded.

 

Thank you.


 

 
1 ACCEPTED SOLUTION

looks ok-ish. I don't remember if these tables are joined in the data model?

 

By the way, instead of IN VALUES() you can also use TREATAS.  Allegedly that is a little faster.

View solution in original post

3 REPLIES 3
lbendlin
Super User
Super User

it's very similar syntax.

 

tblKey[FacilityCode] not in {"61", "52"}

 

or

 

tblKey[FacilityCode] not in VALUES(<enumerator>)  

@lbendlin 

Thank you for your help again.

Does this look good?

 

JustinDoh1_0-1710442705378.png

 

looks ok-ish. I don't remember if these tables are joined in the data model?

 

By the way, instead of IN VALUES() you can also use TREATAS.  Allegedly that is a little faster.

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.