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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Filter table from another table with multiple relationships

I need help figuring out how I can filter a FactTable with a DimTable, where one column in the DimTable is related to two columns in the FactTable.

If I filter a value in the DimTable, I want all rows in FaceTable that matches on at least one of the columns.

 

Example:

I create relationship between Teamleader and Person AND between Responsible and Person. 

If i filter on value C DimTable, I want all rows in FactTable that has C in either Teamleader or Responsible (or both). 

 

FactTable: 

Value

Teamleder

Responsible

10

A

A

10

B

A

5

C

B

20

A

C

20

B

B

15

C

A

 

DimTable:

Person

A

B

C

 

Thank you so much in advance!

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

Hi, @Anonymous 

 

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

Fact:

b1.png

Dim:

b2.png

 

There is no relationship between two tables. You may create a measure as below.

Visual Control = 
IF(
    MAX('Fact'[Teamleader]) in DISTINCT(Dim[Person]) || MAX('Fact'[Responsible]) in DISTINCT(Dim[Person]),
    1,0
)

 

Then you need to put the measure in the visual level filter and use 'Person' from 'Dim' table to filter the result.

b3.png

 

Result:

b4.png

b5.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

4 REPLIES 4
Anonymous
Not applicable

Hi Allan! Thank you so much for the quick and great response! This was perfect for filtering the table just like I wanted. But, why doesnt it work when i have a colum chart visual and want to for example visualize sum of value? 

Thanks again! @v-alq-msft  

v-alq-msft
Community Support
Community Support

Hi, @Anonymous 

 

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

Fact:

b1.png

Dim:

b2.png

 

There is no relationship between two tables. You may create a measure as below.

Visual Control = 
IF(
    MAX('Fact'[Teamleader]) in DISTINCT(Dim[Person]) || MAX('Fact'[Responsible]) in DISTINCT(Dim[Person]),
    1,0
)

 

Then you need to put the measure in the visual level filter and use 'Person' from 'Dim' table to filter the result.

b3.png

 

Result:

b4.png

b5.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.

Anonymous
Not applicable

Hi! I think I made my example above a little too simple. What I actually have is a FactTable with the following columns: Date, Value, ID, Teamleader, Responsible. 

 

And I would like to create a column chart that has year and month on the x-axis. And I have the following measue as value: calculate(Distinctcount(FactTable[ID]))

 

How can I filter the column chart if I want to count number of ID during a month that has person A as either responsible or Teamleader? 

 

The solution above works great when filtering a table with unique ID on each row. But when I aggregate I get problem. 

 

Grateful for your fantastic help as always! Thanks! 

 

Anonymous
Not applicable

 

 

CREATE a table with 

Value , teamleader 

UNION

Value , Responsible

 

remove duplicate values

 

Link dim to second column

Link first column to Value

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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