Forum Discussion

TReynolds's avatar
TReynolds
Helper I
5 years ago
Solved

Filtering a table based on selections from multiple slicers using the same information

Hi forum,

 

I have a dataset that has a list of projects and their outputs. Each project has different a output depending on the scenario in place.

 

Table 1: Dataset

ProjectOuputScenario
Initiative A11
Initiative A22
Initiative A33
Initiative B41
Initiative B52
Initiative B63
Initiative C71
Initiative C82
Initiative C93

 

I wanted to be able to have three different slicers, one for each scenario. So I created three calculated tables, one for each scenario. E.g.,:

Calculated Table: Scenario 1

ProjectOutputScenario
Initiative A11
Initiative B41
Initiative C71

 

Having the three calculated tables worked well for a visualization. I could use three different slicers (e.g., S1 Slicer, S2 Slicer and S3 Slicer) to select the content that would appear in a graph (e.g., Initiative A from Scenario 1, Initiative C from Scenario 2, and Initiative A from Scenario 3).

 

The problem is that I want to create a table that shows the projects that were selected by those slicers (e.g., A from S1, C from S2, and A from S3). If I use the the Project column from the original dataset, I get all of the projects — all Initiatives A, B and C for each Scenario 1, 2 and 3  — instead of only A from S1, C from S2 and A from S3.

 

Any suggestions on what I can do to properly filter the table?

 

Cheers,

 

T

  • Hi, TReynolds 

     

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

     Table:

     

    Calculated table:

    S1 = 
    FILTER(
        'Table',
        [Scenario]=1
    )
    
    S2 = 
    FILTER(
        'Table',
        [Scenario]=2
    )
    
    S3 = 
    FILTER(
        'Table',
        [Scenario]=3
    )

     

    You may create a measure as below.

    Visual Control = 
    IF(
        (SELECTEDVALUE('Table'[Project]) in DISTINCT(S1[Project])&& SELECTEDVALUE('Table'[Scenario]) in DISTINCT(S1[Scenario]))||
        (SELECTEDVALUE('Table'[Project]) in DISTINCT(S2[Project])&& SELECTEDVALUE('Table'[Scenario]) in DISTINCT(S2[Scenario]))||
        (SELECTEDVALUE('Table'[Project]) in DISTINCT(S3[Project])&& SELECTEDVALUE('Table'[Scenario]) in DISTINCT(S3[Scenario])),
        1,0
    )

     

    Finally you need to put the meausre 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.

1 Reply

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

    Hi, TReynolds 

     

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

     Table:

     

    Calculated table:

    S1 = 
    FILTER(
        'Table',
        [Scenario]=1
    )
    
    S2 = 
    FILTER(
        'Table',
        [Scenario]=2
    )
    
    S3 = 
    FILTER(
        'Table',
        [Scenario]=3
    )

     

    You may create a measure as below.

    Visual Control = 
    IF(
        (SELECTEDVALUE('Table'[Project]) in DISTINCT(S1[Project])&& SELECTEDVALUE('Table'[Scenario]) in DISTINCT(S1[Scenario]))||
        (SELECTEDVALUE('Table'[Project]) in DISTINCT(S2[Project])&& SELECTEDVALUE('Table'[Scenario]) in DISTINCT(S2[Scenario]))||
        (SELECTEDVALUE('Table'[Project]) in DISTINCT(S3[Project])&& SELECTEDVALUE('Table'[Scenario]) in DISTINCT(S3[Scenario])),
        1,0
    )

     

    Finally you need to put the meausre 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.