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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
DonTwan
Regular Visitor

Calculating number of shops that sold at least N quantity of a single item

I have a sale table that looks like this:

BookingDateShopIdArticleIdQtyPieces
10/05/2023704788314526
10/05/2023704788308911
10/05/20237047883054410

 

And would like to know how many shops have sold at least 4 total quantity for each of the articles 

 

My matrix is setup as following 

 

DonTwan_0-1693844762991.png

the values are:

Distinct count of shops, sum of QtyPieces and Distinct count of shops where at least 4 of the article is sold.

 

 

CALCULATE( 
    DISTINCTCOUNT(F_Sales_22May23[ClientId]), 
    FILTER( 
        F_Sales_22May23, 
        SUM(F_Sales_22May23[QtyPieces])> 4 
        )
)

 

 

 

the result is

DonTwan_1-1693844793899.png


because the formulla evaluates for each filter context individually, the number of distinct shops = number of shops with at least 4 in quantity sales. 

 

DonTwan_2-1693845113797.png


How do i rewrite the formulla so the totals only count shops that have less than 4 Qty sales. 

 

 

 

 

1 REPLY 1
lbendlin
Super User
Super User

Instead of 

FILTER( 
        F_Sales_22May23, 
        SUM(F_Sales_22May23[QtyPieces])> 4 
        )

use

FILTER( 
        F_Sales_22May23, 
        [QtyPieces]> 4 
        )

or

F_Sales_22May23[QtyPieces]> 4 

 

Same with the <4 approach.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.