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! Request now

Reply
Syndicate_Admin
Administrator
Administrator

Calculate the number of Documents that have fewer than 12 product units in total

Good morning

I ask for their help to solve my problem. I have the following table:

BatPichon_0-1734986023131.png

I want to calculate how many Documents have "Qty" less than 12 units regardless of the "products". Yes, I use

DISTINCTCOUNT result is not correct because it takes each product and not the total of the document. I thank you in advance for the help
5 REPLIES 5
Ashish_Mathur
Super User
Super User

Hi,

Assuming Qty is a measure you have written, write this measure

Measure = countrows(filter(values(Data[Documents]),[Qty]>12))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks but it doesn't work

The solution I found for now was to group the columan in power query, with that I have the document number, the amount and the date that serves me for the measurements I need to create

elitesmitpatel
Super User
Super User

please share the dummy data pbix file for easy reference.

elitesmitpatel
Super User
Super User

Try this Measure 
Documents with Qty < 12 =
CALCULATE (
DISTINCTCOUNT ( YourTable[Document_ID] ),
FILTER (
YourTable,
YourTable[Qty] < 12
)
)
If it helps Please Kudos to work and Accept it as Solution.

Thanks but it doesn't work because for the filter it takes the amount related to the product, I must first have a measure that gives me the total per document and then filter that measure

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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!

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
Top Kudoed Authors