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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Liam01
Helper I
Helper I

Count columns with a value greater than 0

Hi,

 

I've searched everywhere for this and seem unable to find an answer!

 

I'm wanting a measure to count the columns, in a specified range of columns, whereby the value is greater than 0. I've included an example of how this would look - The Count column is the result of the measure and, for example, column A isn't being counted as it's not relevant.

 

Liam01_0-1649859991407.png

 


Any help would be much appreciated.


Thanks 

1 ACCEPTED SOLUTION
davehus
Memorable Member
Memorable Member

Hi @Liam01 ,

 

Try something like this. 

 

Columns Populated = VAR B_C = IF(SUM(Test[B])>=1,1,0)
VAR C_C = IF(SUM(Test[C])>=1,1,0)
VAR D_C = IF(SUM(Test[D])>=1,1,0)
VAR E_C = IF(SUM(Test[E])>=1,1,0)
RETURN B_C+C_C+D_C+E_C

 

davehus_0-1649863360847.png

 

View solution in original post

3 REPLIES 3
davehus
Memorable Member
Memorable Member

Hi @Liam01 ,

 

Try something like this. 

 

Columns Populated = VAR B_C = IF(SUM(Test[B])>=1,1,0)
VAR C_C = IF(SUM(Test[C])>=1,1,0)
VAR D_C = IF(SUM(Test[D])>=1,1,0)
VAR E_C = IF(SUM(Test[E])>=1,1,0)
RETURN B_C+C_C+D_C+E_C

 

davehus_0-1649863360847.png

 

Hi,

I'm returning to this as I need this to do something slightly different and hopefully you may be able to help.

As it works at the minute, it counts the items but if a job appears twice with a B in each occurrence, it will still only return 1. 

I guess i'm wanting this measure to do a count rather than a distinct count, as in the photo below - Top table shows data, bottom shows when it's combined by job number.

So if a job appears twice and each occurrence has an A, the bottom table would show 2. Hopefully that makes sense.

Liam01_0-1653385176417.png

Thanks

 

Hi @davehus,

 

That's great, thanks for that - seems to be just what I was after.

 

Cheers

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

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

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.