Forum Discussion

dgdgdg122db's avatar
dgdgdg122db
Helper II
4 years ago
Solved

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" ...
  • bcdobbs's avatar
    bcdobbs
    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.