Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TReynolds
Helper I
Helper I

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

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @TReynolds 

 

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

 Table:

c1.png

 

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.

c2.png

c3.png

 

Best Regards

Allan

 

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

View solution in original post

1 REPLY 1
v-alq-msft
Community Support
Community Support

Hi, @TReynolds 

 

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

 Table:

c1.png

 

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.

c2.png

c3.png

 

Best Regards

Allan

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.