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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
peterg417
Frequent Visitor

Count entries in 2 different columns

I'm wondering how I would go about calculating this. I want to know how many properties we have Parking Rate information for, regardless of whether it's reserved parking rates or unreserved.

 

In the chart below I have 10 properties. Some have info for 1 column or the other, or both. However, counting and suming both columns will give me an inaccurate result, making it seem like we have 80%, when in reality it is 60%. How would I go about calculating this without double counting in certain situations?

 

Unreserved ParkingReserved Parking
$10$15
 $20
  
$14$20
$10 
  
$18 
  
$20 

 

Thanks!

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @peterg417

 

Try this where Table1 is the table you show:

 

 

Measure =
COUNTROWS (
    FILTER (
        Table1,
        OR (
            Table1[Unreserved Parking] <> BLANK (),
            Table1[Reserved Parking] <> BLANK ()
        )
    )
)

 

to count the number of properties that have info on either type of parking or this measure to calculate the percentage you talk about:

 

Measure2 =
DIVIDE (
    COUNTROWS (
        FILTER (
            Table1,
            OR (
                Table1[Unreserved Parking] <> BLANK (),
                Table1[Reserved Parking] <> BLANK ()
            )
        )
    ),
    COUNTROWS ( Table1 )
)

Code formatted with   www.daxformatter.com

 

 

View solution in original post

2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @peterg417

 

Try this where Table1 is the table you show:

 

 

Measure =
COUNTROWS (
    FILTER (
        Table1,
        OR (
            Table1[Unreserved Parking] <> BLANK (),
            Table1[Reserved Parking] <> BLANK ()
        )
    )
)

 

to count the number of properties that have info on either type of parking or this measure to calculate the percentage you talk about:

 

Measure2 =
DIVIDE (
    COUNTROWS (
        FILTER (
            Table1,
            OR (
                Table1[Unreserved Parking] <> BLANK (),
                Table1[Reserved Parking] <> BLANK ()
            )
        )
    ),
    COUNTROWS ( Table1 )
)

Code formatted with   www.daxformatter.com

 

 

peterg417
Frequent Visitor

Thank you!!

 

I can't verify whether the numbers are correct, but my guess is that they are since they're much lower than when I tried to do it (and the logic in your code makes sense), so I assume that's correct.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.