Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Create a dynamic filter based on another one

Greeting lovely members . 

 

im trying to create a dynamic filter based on another filter . 

an Exemple : 

 

so let's say i have a filter called Years and another filter called Zone  . 

 

what im trying to do is that when i select Zone 1 i want to have a multiselection on the years filter . 

 

i select Zone 1 => in the years filter i have 5 years selected ( 1990- 1995- 2002 - 2003 - 2004 ) 

if i select Zone 2 => in the years filter i have 3 years selected ( 2005-2006-2009)

 

i hope my exemple is clear 

 

Thanks all in Advance . 

 

 

 

 

 

 

 

 

 

 

  • Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end,

    Table:

     

    Zones:

     

    You may create a measure as below.

    Visual Control = 
    IF(
        HASONEVALUE(Zones[Zone]),
        SWITCH(
            SELECTEDVALUE(Zones[Zone]),
            "Zone 1",
            IF(
                SELECTEDVALUE('Table'[Year]) in {1990,1995,2002,2003,2004},
                1,0
            ),
            "Zone 2",
            IF(
                SELECTEDVALUE('Table'[Year]) in {2005,2006,2009},
                1,0
            ),0
        ),0
    )

     

    Finally you need to put the measure in the visual level filter to get the result.

     

    Best Regards

    Allan

     

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

2 Replies

  • v-alq-msft's avatar
    v-alq-msft
    Community Support

    Hi, Anonymous 

     

    Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end,

    Table:

     

    Zones:

     

    You may create a measure as below.

    Visual Control = 
    IF(
        HASONEVALUE(Zones[Zone]),
        SWITCH(
            SELECTEDVALUE(Zones[Zone]),
            "Zone 1",
            IF(
                SELECTEDVALUE('Table'[Year]) in {1990,1995,2002,2003,2004},
                1,0
            ),
            "Zone 2",
            IF(
                SELECTEDVALUE('Table'[Year]) in {2005,2006,2009},
                1,0
            ),0
        ),0
    )

     

    Finally you need to put the measure in the visual level filter to get the result.

     

    Best Regards

    Allan

     

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