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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. 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
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.