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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Baarathi88
Helper III
Helper III

Restrict based on summation

Is there a way to Count Distinct Order with Sales above 300.

 

I tried this expression but getting wrong result. 

Order Count = CALCULATE(DISTINCTCOUNT(Sheet1[OrderID]),FILTER(Sheet1,Sum(Sheet1[Sales])>300))
 
No. of Orders with sales over 300 is 2. But I'm getting the result as 4 using the above expression.

 

 

 

OrderIDOrderDateShippedDateDelivery DateSales
113/1/202015/02/202013/03/2020100
215/02/202013/03/202015/04/202050
215/02/202013/04/202015/05/2020300
315/02/202013/03/202015/04/2020250
315/02/202013/04/202015/05/202060
415/02/202013/03/202015/04/202030
415/02/202013/04/202015/05/202080
1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Baarathi88 

It's all about context.  Give this a try:

Order Count = 
CALCULATE(
    DISTINCTCOUNT( Sheet1[OrderID] ),
    FILTER ( 
        VALUES(Sheet1[OrderID]),
        CALCULATE( SUM ( Sheet1[Sales] ) > 300 )
    )
)

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Baarathi88 

It's all about context.  Give this a try:

Order Count = 
CALCULATE(
    DISTINCTCOUNT( Sheet1[OrderID] ),
    FILTER ( 
        VALUES(Sheet1[OrderID]),
        CALCULATE( SUM ( Sheet1[Sales] ) > 300 )
    )
)

@jdbuchanan71 Thank you, that works

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.