Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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?
Solved! Go to 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
)
)
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.
@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
)
)
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.
User | Count |
---|---|
98 | |
87 | |
77 | |
67 | |
63 |
User | Count |
---|---|
110 | |
95 | |
95 | |
64 | |
58 |