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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
chanon
New Member

How to count rows with conditions from measure

I have a measure DoH derived from creation of Measure ( DoH = Stock / Avg. Usage) 

chanon_0-1661505883498.png

and I want to count Product name at DoH< 10 = ? and  DoH > 100 = ?  

From example  - DoH < 10 = 3

                         - DoH > 100 = 1 

1 ACCEPTED SOLUTION

This is what I'm getting:

DoH = 
DIVIDE(SUM('Table'[Stock]), SUM('Table'[Avg. Usage]))
Less than 10 =
CALCULATE ( COUNT ( 'Table'[Product name] ), FILTER ( 'Table', [DoH] < 10 ) )
More than 100 =
CALCULATE ( COUNT ( 'Table'[Product name] ), FILTER ( 'Table', [DoH] > 100 ) )

result.png





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
v-henryk-mstf
Community Support
Community Support

Hi @chanon ,

 

Whether the advice given by @PaulDBrown  has solved your confusion, if the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.


Looking forward to your feedback.


Best Regards,
Henry

PaulDBrown
Community Champion
Community Champion

Try:

Less than 10 = 
CALCULATE(COUNT(Table[Product[), FILTER(Table, [DoH] <10))
More than 100 = 
CALCULATE(COUNT(Table[Product[), FILTER(Table, [DoH] >100))




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Thk for reply but didn't work. Due to DoH is Measure when i create count measure then result is 7. 

This is what I'm getting:

DoH = 
DIVIDE(SUM('Table'[Stock]), SUM('Table'[Avg. Usage]))
Less than 10 =
CALCULATE ( COUNT ( 'Table'[Product name] ), FILTER ( 'Table', [DoH] < 10 ) )
More than 100 =
CALCULATE ( COUNT ( 'Table'[Product name] ), FILTER ( 'Table', [DoH] > 100 ) )

result.png





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Arul
Super User
Super User

@chanon ,

please try this,

1. DoH < 10,

count of product DoH < 10 = CALCULATE(COUNT('Table'[Product name]),FILTER('Table',[DOH]<10))

2.DoH >100,

count of product DoH > 100 = CALCULATE(COUNT('Table'[Product name]),FILTER('Table',[DOH]>100))

Thanks,

Arul





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

Proud to be a Super User!


LinkedIn


Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!