Forum Discussion

Gutenvirt's avatar
Gutenvirt
Frequent Visitor
9 years ago
Solved

Filter based on another column's value from an associated sclicer selection.

Hello,

 

I have a table of site names and site types.  If a user selects one of the site names in a slicer, how I can show all other site names that have the same site type (based on the slicer selection)?

 

I.e.

 

Site_Name    Site_Type

Site A            1

Site B            1

Site C            2

Site D            3

Site E            1

 

User selects 'Site A' and a table populates with 'Site A', 'Site B', and 'Site E'

 

Thanks!

 

  • Hi Gutenvirt,

     

    In this scenario, you should replicate the original table. As a result, there are two tables (In my test, test1 and test2) containing same columns, [Site Name] and [Site Type].

     

    Create a measure like below

     

    Site Type measure =
    CALCULATE (
        LASTNONBLANK ( test1[Site Type], 1 ),
        FILTER ( 'test1', 'test1'[Site Type] = MAX ( test2[Site Type] ) )
    )

    Add 'test2'[Site Name] into slicer and add 'test1'[Site Name]and measure [Site Type measure] into table visual.

     

    Best regards,
    Yuliana Gu

1 Reply

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi Gutenvirt,

     

    In this scenario, you should replicate the original table. As a result, there are two tables (In my test, test1 and test2) containing same columns, [Site Name] and [Site Type].

     

    Create a measure like below

     

    Site Type measure =
    CALCULATE (
        LASTNONBLANK ( test1[Site Type], 1 ),
        FILTER ( 'test1', 'test1'[Site Type] = MAX ( test2[Site Type] ) )
    )

    Add 'test2'[Site Name] into slicer and add 'test1'[Site Name]and measure [Site Type measure] into table visual.

     

    Best regards,
    Yuliana Gu