Forum Discussion

Emmy66's avatar
Emmy66
Helper V
2 years ago

Multi value selection from slicer

Hi, I'm struggling to wrap my head around this. Any help will be appreciated.

 

I have a report which uses measures that requires user input from from 2 different slicers as shown below. 

 

 

Below is my dax query which is returning blank. The aim is for me to use the input in the return query against the higlighted columns. i.e. inputs from vYear & vQtr

Payment = 

VAR  vDate = MAX(Calendar[CY Date])

VAR  vYear = YEAR(vDate)-1

VAR vQtr = VALUES(Calendar[quarter])

return

calculate ([Amount],filter(FactTable, FactTable[Year] = vDate && FactTable[Quarter] IN vQtr))

 

 

 

4 Replies

  • Hi Emmy66 - can you try the below dax code and modify as per your tables and columns

    Payment =
    VAR vYears = VALUES(Calendar[Year])
    VAR vQtrs = VALUES(Calendar[Quarter])

    RETURN
    CALCULATE(
    [Amount],
    FILTER(
    FactTable,
    FactTable[Year] IN vYears &&
    FactTable[Quarter] IN vQtrs
    )
    )

     

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

    • Emmy66's avatar
      Emmy66
      Helper V

      rajendraongole1 Thanks for your prompt response. I tried it out but it still returned blank. The reason I had the 1st & 2nd variables in my request is to give me the flexibility to create different measures using either 2 years + or 2 years behind i.e. 2022 or 2026.

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Emmy66 ,

    Please have a try.

    Create a measure.

    VAR vDate = MAX(Calendar[CY Date])
    VAR vYear = YEAR(vDate) - 1
    VAR vQtr = VALUES(Calendar[quarter])
    
    RETURN
    CALCULATE(
        [Amount],
        FILTER(
            FactTable,
            FactTable[Year] = vYear && FactTable[Quarter] IN vQtr
        )
    )

     

    How to Get Your Question Answered Quickly - Microsoft Fabric Community

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Rongtie

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

     

     

     

    • Emmy66's avatar
      Emmy66
      Helper V

      Anonymous Thanks for your response, which I appreciate a lot. The proposed solution is same with what I tried earlier which didn't work. I've attached a pbix file Multiselect.pbix with the required details and the result of the query too. Any help on this will go a long way. Thanks in advance