Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Mariollo
Helper I
Helper I

How to Count Values From Column Where Values In Other Column Are Empty

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:

  • COUNTRY
  • CITY
  • ATTRIBUTE
  • PRODUCT

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:

Mariollo_0-1732615519865.png

 

 

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!

1 ACCEPTED SOLUTION
Bibiano_Geraldo
Super User
Super User

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:

Bibiano_Geraldo_0-1732614761619.png

 

View solution in original post

5 REPLIES 5
Mariollo
Helper I
Helper I

Yes, It works as expected.

Thank you.

 

Happy it worked! 😊

 

Bibiano_Geraldo
Super User
Super User

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:

Bibiano_Geraldo_0-1732614761619.png

 

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

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors