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
ARomain
Helper I
Helper I

New Measure with multiple does not contain filters

I am trying to create a new measure within Power BI Desktop.  I want it to distinct count all Product ID's that are only sent to certain locations and not to others

 

1. Transport Site = New Orleans

2. Transport Site is not New York

3. Transport Site is not Los Angeles

 

I would assume the below would work, but it does not

 

Calculate(DistinctCount(Sheet1[CaseID],

Filter(Sheet1, 

'Sheet1'[TransportSite] = "New Orleans"),

Filter(Sheet1,

'Sheet1'[TransportSite] <> "New York"

|| 'Sheet1'[TransportSite]<> "Los Angeles"))

 

However, when I do this and it doesn't work. Any advice?

 

 

1 ACCEPTED SOLUTION

Hi, @ARomain 

Create a new measure to count the number of location in each ProductID:

 

Count of location = 
CALCULATE (
    COUNT ( 'Table'[Location] ),
    ALLEXCEPT ( 'Table', 'Table'[Product ID] )
)

 

Then change the second filter condition in your original measure as below:

 

Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Product ID] ),
    FILTER (
        'Table',
        'Table'[Location] = "New Orleans"
            && [Count of location] = 1
    )
)

 

39.png

 

 

 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@ARomain , When Transport Site = New Orleans , then it not equal to any other value.

I doubt conditions are  correct

I have data that looks like this

 

Product ID                           Location

1001                                    New Orleans

1001                                    New York

1002                                    New Orleans

1002                                    Los Angeles

1003                                    New York

1004                                    New Orleans

 

I am trying to find the item that ONLY went to New Orleans. In this case, it is just 1 (1004)

 

If I set my filter to Location=New Orleans, it brings me back a value of 3 (1001, 1002, 1004)

 

 

Hi, @ARomain 

Create a new measure to count the number of location in each ProductID:

 

Count of location = 
CALCULATE (
    COUNT ( 'Table'[Location] ),
    ALLEXCEPT ( 'Table', 'Table'[Product ID] )
)

 

Then change the second filter condition in your original measure as below:

 

Count = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[Product ID] ),
    FILTER (
        'Table',
        'Table'[Location] = "New Orleans"
            && [Count of location] = 1
    )
)

 

39.png

 

 

 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

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.