Forum Discussion
SWITCH between filters
C-Jac , You need to have a table with three rows
CustomPeriod1
CustomPeriod2
CustomPeriod3
Now based on the selected input
measure =
Var _sel = Switch(selectedValue(Period[period]) ,
"CustomPeriod1", Filter(TransactionDates,TransactionDates[CustomPeriod1]=1),
"CustomPeriod2", Filter(TransactionDates,TransactionDates[CustomPeriod2]=1),
"CustomPeriod3", Filter(TransactionDates,TransactionDates[CustomPeriod3]=1)
)
return
calculate(sum(Transaction[TransactionAmount]), _sel)
I tried this but it gives me following error:
Repayments By Period:=
VAR _sel = SWITCH(SELECTEDVALUE(ShowPeriodsTable[Period]),
"1 Year" , FILTER(_TransactionDateCalendar, _TransactionDateCalendar[ThisQuarterAndNext3] = 1),
"2 Years" , FILTER(_TransactionDateCalendar , _TransactionDateCalendar[ThisQuarterAndNext7] = 1),
"3 Years", FILTER(_TransactionDateCalendar , _TransactionDateCalendar[ThisQuarterAndNext11] = 1),
"4 Years", FILTER(_TransactionDateCalendar, _TransactionDateCalendar[ThisQuarterAndNext15] = 1)
)
RETURN
CALCULATE(SUM(Fact_Transaction[Transaction Amount]), _sel)