Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Solved! Go to Solution.
Hi @aiton_grant
Try below:
Customers measure =
CALCULATE(
DISTINCTCOUNT('Purchase FACT'[Customer ID]),
FILTER(
VALUES('Purchase FACT'[Customer ID]),
VAR HasBikeOrScooter =
CALCULATE(
COUNTROWS('Purchase FACT'),
'Product Detail'[Product Category] IN {"BIKE", "Scooter"}
) > 0
VAR HasCar =
CALCULATE(
COUNTROWS('Purchase FACT'),
'Product Detail'[Product Category] = "CAR"
) > 0
RETURN
HasBikeOrScooter && NOT(HasCar)
)
)Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
Hi @aiton_grant ,
I think you want to count the customers that never had bought any car. So you can write a measure as follows:
Hi @aiton_grant ,
I think you want to count the customers that never had bought any car. So you can write a measure as follows:
This was helpful, and worked with a very small dataset, but led to lack of resource timeouts when I tried it for the whole dataset.
To simplify the DAX code, take the Customer from the Sales table and for a single value you do not need IN
CALCULATE(
DISTINCTCOUNT(Sales[Customer ID]),
'Product Detail'[Product Category] <> "CAR",
'Product Info'[Product Category] IN {"BIKE", "Scooter"}
)
If this helped, please consider giving kudos and mark as a solution
@me in replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi @aiton_grant
Try below:
Customers measure =
CALCULATE(
DISTINCTCOUNT('Purchase FACT'[Customer ID]),
FILTER(
VALUES('Purchase FACT'[Customer ID]),
VAR HasBikeOrScooter =
CALCULATE(
COUNTROWS('Purchase FACT'),
'Product Detail'[Product Category] IN {"BIKE", "Scooter"}
) > 0
VAR HasCar =
CALCULATE(
COUNTROWS('Purchase FACT'),
'Product Detail'[Product Category] = "CAR"
) > 0
RETURN
HasBikeOrScooter && NOT(HasCar)
)
)Please give kudos or mark it as solution once confirmed.
Thanks and Regards,
Praful
This was the best solution! Thank you!
Hi,
Share some data to work with and show the expected result. Share data in a format that can be pasted in an MS Excel file.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 35 | |
| 33 | |
| 32 | |
| 27 |
| User | Count |
|---|---|
| 136 | |
| 96 | |
| 77 | |
| 67 | |
| 65 |