Forum Discussion

Baarathi88's avatar
Baarathi88
Helper III
6 years ago
Solved

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
  • 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 )
        )
    )

2 Replies

  • 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 )
        )
    )