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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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