Forum Discussion

Kopek's avatar
Kopek
Icon for Helper IV rankHelper IV
4 years ago
Solved

Dax for select All

Hey!

 

I want to introduce "Select All" option in a clicket slicer.

I do have a list of qtrs like below.
What i want to achieve is - when "Select All" is clicked all available qtrs would be visible, otherwise only relevant qtr would be visible (if q1 2020 selected only data for q1 would be visible)

Could you please help me in writing this dax code ?

 

Quarter
Q1 2018
Q2 2018
Q3 2018
Q4 2018
Q1 2019
Q2 2019
Q3 2019
Q4 2019
Q1 2020
Q2 2020
Q3 2020
Q4 2020
Q1 2021
Q2 2021
Q3 2021
Q4 2021
Q1 2022
Q2 2022
Q3 2022
Q4 2022
Select All

 

 

Thanks in advance!

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Kopek ,

    Please refer to my pbix file wo see if it helps you.

    Create a new table based on the table.

    Table_copy = SUMMARIZE('Table','Table'[Quarter])

    Then put the table_copy[Quanter] into the slicer.

    Then create a measure.

    Measure =
    IF (
        SELECTEDVALUE ( Table_copy[Quarter] ) = "Select All"
            && SELECTEDVALUE ( 'Table'[Quarter] ) <> "Select All",
        1,
        IF (
            SELECTEDVALUE ( 'Table'[Quarter] ) = SELECTEDVALUE ( Table_copy[Quarter] ),
            1,
            0
        )
    )
    

    Then filter the measure.

     

    Best Regards

    Community Support Team _ Polly

     

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

     

13 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Kopek ,

    Please refer to my pbix file wo see if it helps you.

    Create a new table based on the table.

    Table_copy = SUMMARIZE('Table','Table'[Quarter])

    Then put the table_copy[Quanter] into the slicer.

    Then create a measure.

    Measure =
    IF (
        SELECTEDVALUE ( Table_copy[Quarter] ) = "Select All"
            && SELECTEDVALUE ( 'Table'[Quarter] ) <> "Select All",
        1,
        IF (
            SELECTEDVALUE ( 'Table'[Quarter] ) = SELECTEDVALUE ( Table_copy[Quarter] ),
            1,
            0
        )
    )
    

    Then filter the measure.

     

    Best Regards

    Community Support Team _ Polly

     

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