I have imported Order table from SQL into PowerBI
Order Table has Data Like below.
ID OrderNo CustomerNo OrderDate
1 DC001 1001 2020-06-01
1 DC002 1002 2020-06-09
1 DC003 1003 2020-06-10
Note: I want to Execute below Query in PowerBI DAX
Select Count(Distinct CustomerNo)
From [order] where orderdate >= '2020-06-08' and orderdate <= '2020-06-14'
And CustomerNo
Not in (select CustomerNo from [order] where orderdate < '2020-06-08')
I have tried below code in DAX
MEASURE NOT IN =
VAR indexList =SELECTCOLUMNS (
FILTER('Order','Order'[OrderDate] > [RangeFromDate]),"Distict", DISTINCTCOUNT ('Order'[CustomerNo]))
RETURN
SUMMARIZE (
FILTER('Order',
NOT ('Order'[CustomerNo]) IN indexList),
"Count",Count ( 'Order'[CustomerNo] )
)
Note: [RangeFromDate] is MEASURE dynamically load From date from the slicer.
But Not Working for me. Kindly Help me to solve this in PowerBI DAX