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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jalaomar
Helper IV
Helper IV

count rows with conditions

Hi,

 

could someone support with a measure that i would like to create. 

Have the column KPI: VSU 6 Weeks where i have blank rows, rows with value 0 & 1.

how to count rows with value = 1?

 

The measure created gives me an error 

 

2021-11-25_14-33-35.png

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@jalaomar , if KPI: VSU 6 Weeks is column then your formula or below measure should work

 

countrows(filter('KPI', 'KPI'[KPI: VSU 6 Weeks] =1 && not(isblank('KPI'[KPI: VSU 6 Weeks]))))

 

If this a measure 

then you need some unique combination to filter like

countrows(filter(summarize(Table, Table[Cluseter], [Applicant], [Project Id], "_1", [KPI: VSU 6 Weeks] ), [_1] =1 ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@jalaomar , if KPI: VSU 6 Weeks is column then your formula or below measure should work

 

countrows(filter('KPI', 'KPI'[KPI: VSU 6 Weeks] =1 && not(isblank('KPI'[KPI: VSU 6 Weeks]))))

 

If this a measure 

then you need some unique combination to filter like

countrows(filter(summarize(Table, Table[Cluseter], [Applicant], [Project Id], "_1", [KPI: VSU 6 Weeks] ), [_1] =1 ) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Yes, it is a measure and the suggestion worked 🙂

Many thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.