Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Is it possible to get the values selected ( multiple selection ) and put them into a filter?

Hi everyone, 

 

I would like to know if it is possible to get the values selected ( multiple selections) in a slicer and put them into a filter.

For example, I have 3 tables that seem like the below: 

I am using this code:

VAR S_YEAR = YEAR(SELECTEDVALUE('Calendar'[Date]))
VAR S_EMP = SELECTEDVALUE('TRANSACTION'[Employee_ID])
VAR S_MONTH= IF(ISFILTERED('Calendar'[Month]), CONCATENATEX( ALLSELECTED('Calendar'[Month]),'Calendar'[Month]," , "),"(All)")
VAR _KPI= CALCULATE(
SUM( 'KPI'[KPI_USD]), FILTER('KPI', FORMAT ('KPI'[Month],"####") IN {FORMAT(S_MONTH,"####")} && 'KPI'[EMPLOYEE_ID] = S_EMP && 'KPI'[Year] = S_YEAR))
RETURN (SUM('TRANSACTION'[REVENUE_USD])/_KPI
 
This code works as well if I selected a month on the slicer, but when I picked multiple months, nothing happens.
How can I do it? Can I use a switch or something? Please help me.
Have a good day.
 

1 Reply

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 
    Why don't you connect Calendar[Month] with KPI[Month] Many to Many Calendar filters KPI?