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 number of rows where filter is 1

Hello All,

 

Could you please help to calculate number of rows where filter is 1? I've put this formula but there are wrong calculation:

 

Count lines undeliv = CALCULATE(COUNTROWS(CDP_data);FILTER('CDP_data';'CDP_data'[Negative))
 
Many thanks for your help.
6 REPLIES 6
AlB
Community Champion
Community Champion

Hi @Anonymous 

How do you tell it's not delivered? CAn you show a sample of your table?Try something like this  

Count lines undeliv =
CALCULATE (
    COUNTROWS ( CDP_data );
    FILTER ( 'CDP_data'; 'CDP_data'[Undelivered] = 1 )
)
Anonymous
Not applicable

Hi @AlB not delivered i've counted like that:  Negative = if(CDP_data[Undelivered]<0;1;0)

 

AlB
Community Champion
Community Champion

Ok, so then this should work, as a measure in a card visual. If it doesn't, please share a sample of your tables or the pbix:

Count lines undeliv =
CALCULATE (
    COUNTROWS ( CDP_data );
    FILTER ( 'CDP_data'; 'CDP_data'[Undelivered] < 0  )
)

 

Anonymous
Not applicable

@AlB It's working but calculcation is wrong.

I have columnt oredered, delivered, undelivered which is calculated: 

Undelivered = if(CDP_data[Delivered qty]<=CDP_data[Ordered qty];CDP_data[Delivered qty]-CDP_data[Ordered qty];0)+0
And after negative:  Negative = if(CDP_data[Undelivered]<0;1;0)
And I need to know hom many negative (1) lines are in total. 

 

 

 mistake_negative.JPG

Hi @Anonymous ,

Create a measure as below.

countrows =  CALCULATE (
    COUNTROWS ( CDP_data );
    FILTER ( 'CDP_data'; 'CDP_data'[Negative] =1  )
)
Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

@v-frfei-msft still the same mistake when I have =1, but it counts correctly when i choose =0. 

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