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

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

Reply
BlueWhite3699
Helper III
Helper III

Count if a row in a column has a value in it - Calculate column measure

Hi Experts

 

See example sample data below. Property 1135 has partial data for all four utilities and hence the "P", Property 1125 has all Utility data hence the "F" and finally 1110 has no utility data and hence the N in the expected result column. How can i achieve this as a calculated column in Power BI and or Power Query???

 

Property CodeElecWaterGasHeatEnd Result
113525203P
1252351112F
1110    N
1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @BlueWhite3699  - you can create a new calculated column as below:

 

End Result1 =
VAR NonBlankCount =
    COUNTX(
        {
            IF([Elec] = 0 || ISBLANK([Elec]), BLANK(), [Elec]),
            IF([Water] = 0 || ISBLANK([Water]), BLANK(), [Water]),
            IF([Gas] = 0 || ISBLANK([Gas]), BLANK(), [Gas]),
            IF([Heat] = 0 || ISBLANK([Heat]), BLANK(), [Heat])
        },
        IF(NOT(ISBLANK([Value])), 1, BLANK())
    )

RETURN
    IF(NonBlankCount = 0, "N", IF(NonBlankCount < 4, "P", "F"))

rajendraongole1_0-1741873299257.png

 

 

Hope this will gives you the expected result.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
BlueWhite3699
Helper III
Helper III

Excellent

rajendraongole1
Super User
Super User

Hi @BlueWhite3699  - you can create a new calculated column as below:

 

End Result1 =
VAR NonBlankCount =
    COUNTX(
        {
            IF([Elec] = 0 || ISBLANK([Elec]), BLANK(), [Elec]),
            IF([Water] = 0 || ISBLANK([Water]), BLANK(), [Water]),
            IF([Gas] = 0 || ISBLANK([Gas]), BLANK(), [Gas]),
            IF([Heat] = 0 || ISBLANK([Heat]), BLANK(), [Heat])
        },
        IF(NOT(ISBLANK([Value])), 1, BLANK())
    )

RETURN
    IF(NonBlankCount = 0, "N", IF(NonBlankCount < 4, "P", "F"))

rajendraongole1_0-1741873299257.png

 

 

Hope this will gives you the expected result.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





if you got the expected output. Please mark my post as a solution.  it helps others. 

 

Thank you





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
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