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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.