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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. Register now.

Reply
BlueWhite3699
Helper II
Helper II

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 II
Helper II

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

Find out what's new and trending in the Fabric community.