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.
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!
Solved! Go to Solution.
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Fact:
Dim:
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.
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.
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
Hi, @Anonymous
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Fact:
Dim:
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.
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.
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!
CREATE a table with
Value , teamleader
UNION
Value , Responsible
remove duplicate values
Link dim to second column
Link first column to Value
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
129 | |
106 | |
106 | |
86 | |
72 |