Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Get slicer selected values in table

Hi everyone,   I would like to know if it is possible to get the values selected in a slicer and put them in a table ?    In fact, I have a hirerarchical slicer with continents and for each conti...
  • v-luwang-msft's avatar
    4 years ago

    Hi Anonymous ,

    Refer the below:

    base data table:

    Slicer:

    Step 1,create measure on slicer:

    Measure 2 = CALCULATE(SUM(Slicer[value]),FILTER(Slicer,Slicer[Name]=SELECTEDVALUE('Table'[Country])))

    Step2,use the measure on base table:

    valueqq = 
    VAR _1 =
        EXCEPT ( ALL ( 'Table'[Country] ), ALLSELECTED ( Slicer[Name] ) )
    RETURN
        IF (
            CALCULATE ( IF ( ISFILTERED ( 'Slicer'[Name] ), 1, 0 ), ALLSELECTED ( Slicer ) ) = 0,
            [maxvalue],
            IF (
                CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Country] IN _1 ) ) = 1,
                MAX ( 'Table'[value] ),
                [Measure 2]
            )
        )
    

    Output result:

     

    I provided my pbix if you need.

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


    Best Regards

    Lucien