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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Count "1" values in a column

Hi All,

 

I've spent far too many hours today trying to figure out what is probably a simple thing for you all...

 

I have a column in PBI that has either 0 or 1 in it for 200+ rows.  I want to count the "1"'s.  I've tried allsorts and been through all of the questions and answers here but they are far more complicated than this.

The column with the 0 and 1 in is "Start 28d" - please help? This would be simple in Excel: countif(range > 0) or something.

 

Thanks,

Martin

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Anonymous 

if the column only has two values,0 and 1, what about use SUM ? The result of SUM is the result of counting 1.





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

Proud to be a Super User!




View solution in original post

8 REPLIES 8
ryan_mayu
Super User
Super User

@Anonymous 

if the column only has two values,0 and 1, what about use SUM ? The result of SUM is the result of counting 1.





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

Proud to be a Super User!




Anonymous
Not applicable

Thanks for this - I should have gotten it, but my mind was set on 'count'.  All working as it should - thank you 🙂

you are welcome





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

Proud to be a Super User!




serpiva64
Solution Sage
Solution Sage

Hi,

try 

Measure = calculate(count('Table'[Column1]),'Table'[Column1]=1)
Anonymous
Not applicable

Thanks! This worked for one of them (start dates) but gives me an error when trying to replicate for finish dates?

 

Finish 28d = IF(Task[Finish Next Period] > -28 && Task[Finish Next Period] < 0, 1, 0)
Finish 28d Qty = CALCULATE ( count (Task[Finish 28d] ),Task[Finish 28d] = 1 )

Start 28d = IF(Task[Start Next Period] > -28 && Task[Start Next Period] < 0, 1, 0)
Start 28d qty = CALCULATE ( COUNT ( Task[Start 28d] ), Task[Start 28d] = 1 )

 

MBCLogik_0-1653585319514.png

 

Hi,

i don't think it's a problem of the measure.

Task[Finish Next Period] or Task[Start Next Period] are calculated columns?

 

Anonymous
Not applicable

Finish Next Period = Task[ReportDate] - Task[Finish]
Start Next Period = Task[ReportDate] - Task[StartDate]
Anonymous
Not applicable

Yes they are calculated.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors