I have a table named 'Master Query' that holds a column called 'RegisterDate'. My PowerBI dashboard has Date Slicer that allows the user to control the data shown on a Matrix table. I am trying to create a new summarised table by filtering the MIN and MAX Date ranges that the user has chosen in the slicer.
I have tried this DAX code below but it seems the dates are not being picked up as all rows are returning rather than only summarising the rows within the desired date range:
HE KPI Card =
VAR _MinDate = CALCULATE(MIN('Master Query'[RegisterDate]),ALLSELECTED('Master Query'[RegisterDate]))
VAR _MaxDate = CALCULATE(MAX('Master Query'[RegisterDate]),ALLSELECTED('Master Query'[RegisterDate]))
RETURN
CALCULATETABLE(SUMMARIZE('Master Query',Students[ID],'KPItarget'[Description],"Mark1",SUM('Master Query'[Mark1]),"Mark2",SUM('Master Query'[Mark2]),"AuthCount",SUM('Master Query'[AuthorisedCount])),FILTER('Master Query','Master Query'[RegisterDate] >= _MinDate && 'Master Query'[RegisterDate] <= _MaxDate))
Main part of DAX code:
HE KPI Card =
VAR _MinDate = CALCULATE(MIN('Master Query'[RegisterDate]),ALLSELECTED('Master Query'[RegisterDate]))
VAR _MaxDate = CALCULATE(MAX('Master Query'[RegisterDate]),ALLSELECTED('Master Query'[RegisterDate]))
RETURN
FILTER('Master Query','Master Query'[RegisterDate] >= _MinDate && 'Master Query'[RegisterDate] <= _MaxDate))
How would I go about doing this? I am unsure why my DAX is not working...perhaps there is a better way of doing it within PowerBI