Forum Discussion
Help with DAX Filtering
Thank you both for your help.
I've created an example .pbix.
The solutions provided are useful, but dont quite meet the requirement on point 3.
Essentially I believe that point 3 is intersect of point 1 and 2. My DAX terminology isnt too hot so its hard to describe. This pseudo sql might help.
SELECT COUNT(DISTINCT SALE_ID)
FROM SaleEvent
INNER JOIN DIM_DATE
ON SaleEvent.Date = DIM_DATE.date
WHERE (SaleStageEvent = 'Event A - Actual' AND DIM_DATE.WEEK_ENDING <= @Weekending)
OR
(SaleStageEvent = 'Event B - Forecast' AND DIM_DATE.Year = @Year)
Its the number of sales where both Event A has actually occured in the past and Event B is forecast to occur in the year.
Hope that helps clarify and many thnaks fro your help.
hi, Anonymous
I use this formula for point 3 in your sample report, it works well.
3) No. of Sales where event A has actually occurred to date and event B is forecast to occur this year =
CALCULATE (
DISTINCTCOUNT ( 'Sale Event'[Sale ID] ),
'Sale Event'[Sale Stage Event] = "Event B - Forecast",
FILTER (
ALL ( DimDate ),
DIMDATE[WEEK_ENDING] <= MAX ( DimDate[WEEK_ENDING])&&
DimDate[YEAR]= MAX ( DimDate[YEAR] )
)
)
Why it doesn't quite meet the requirement on point 3?
Best Regards,
Lin