Forum Discussion
dgdgdg122db
4 years agoHelper II
variables virtual tables
Hello there, I am trying to count the number of orders for the customers who has the total order value above 50K. My DAX looks like below, I just do not how to continue. How to pass the "50orders" ...
- 4 years ago
Sorry misunderstood your requirement. Hard to test without some data but I think you want to do something like:
#Orders (Buyers OrderValue>50k) = VAR Customers50k = FILTER ( VALUES ( 'Orders'[CustomerID] ), CALCULATE ( SUM( Orders[Order Value EUR]) ) > 50000 ) RETURN CALCULATE ( DISTINCTCOUNT ( Orders[Sales document] ), Customers50k )Effectively generate the list of CustomerIds and then use it as a filter inside calculate.
bcdobbs
4 years agoCommunity Champion
Sorry misunderstood your requirement. Hard to test without some data but I think you want to do something like:
#Orders (Buyers OrderValue>50k) =
VAR Customers50k =
FILTER (
VALUES ( 'Orders'[CustomerID] ),
CALCULATE ( SUM( Orders[Order Value EUR]) ) > 50000
)
RETURN
CALCULATE (
DISTINCTCOUNT ( Orders[Sales document] ),
Customers50k
)
Effectively generate the list of CustomerIds and then use it as a filter inside calculate.
dgdgdg122db
4 years agoHelper II
Thank you very much bcdobbs