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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hello everyone,
I am working on a Power BI report and need some help creating a DAX measure. Here's the scenario:
I have a dataset with the following columns:
I want to calculate the number of unique cities where all rows in the PRODUCT column are empty. If a city has even one non-empty PRODUCT, it should be excluded from the count.
For example, in the dataset below:
The result should be 1, because only LONDON satisfies the condition that all PRODUCT rows are empty, and LONDON is counted once as a unique city.
Could someone help me write a DAX measure to achieve this?
Thank you!
Solved! Go to Solution.
Hi @Mariollo ,
You can achieve your goal by this measure:
UniqueEmptyProductCities =
CALCULATE(
COUNTROWS(
FILTER(
VALUES('Table'[CITY]),
CALCULATE(
COUNTROWS('Table'),
NOT(ISBLANK('Table'[PRODUCT]))
) = 0
)
)
)
As you can see bellow, in the card, the result is 1 and in the table the result was LONDON:
Yes, It works as expected.
Thank you.
Happy it worked! 😊
Hi @Mariollo ,
You can achieve your goal by this measure:
UniqueEmptyProductCities =
CALCULATE(
COUNTROWS(
FILTER(
VALUES('Table'[CITY]),
CALCULATE(
COUNTROWS('Table'),
NOT(ISBLANK('Table'[PRODUCT]))
) = 0
)
)
)
As you can see bellow, in the card, the result is 1 and in the table the result was LONDON:
This one works, but I simplified too much my data.
What if I have many other columns with attributes for each product?
(Updated first post)
It will work, because we're using only the column of city and product to reach our goal.
try out and give me a feedback.
Thank you
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 64 | |
| 51 | |
| 46 | |
| 23 | |
| 19 |
| User | Count |
|---|---|
| 136 | |
| 110 | |
| 50 | |
| 32 | |
| 29 |