March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I'm looking for some ideas to achieve dynamic filtering across multiple fact tables based on user selection.
In my model, there are
Please see relationships below
Project Dimension stores a full list of projects while a subset of projects are in the fact tables given that only projects that have budget, actual cost or/and forecast will show up in the fact - e.g. 1000 projects in Project Dimension and 300 projects in Budget Fact, 200 projects in Forecast Fact, etc.
We are looking at answering business questions based on the financial years user selected in the reports such as (the FY given in the below examples should come from the slicer and users can select more than one financial year):
Here are examples of the expected output in red using sample data:
Key requirements are:
Ideally we'd like to drive the reporting from Project Dimension as it has a relationships with all the fact tables. I'm not sure if it's possible. So far I've thought about using DAX to calculate different flags (e.g. has budget, has forecast) as measures so we can filter the list but can't use them as page filter. Others have suggested that maybe we could have a mapping table that filters the Project Dimension to only keep the projects with budget/forecast/actual cost.
What might be the best solution? Thank you.
Would you be able to combine the 3 facts into one, and have Budget, Fact and Forecast be distinct columns in that one fact table? I think that would make the filtering easier, because you could just sent conditions that if Fact[Budget] = (BLANK) then the given project does not have a budget...
Proud to be a Super User! | |
Thanks for the suggestion. Yeah that could work, I've tested it on a small scale and just need to see how it goes with more data and other tables.
Hi @tingh
o achieve dynamic filtering across multiple fact tables based on user selection in Power BI, you can use a combination of DAX measures and calculated columns. Here’s a step-by-step approach to help you set this up:
Create a Mapping Table:
ProjectMapping =
SUMMARIZE(
UNION(
SELECTCOLUMNS(BudgetFact, "ProjectID", BudgetFact[ProjectID], "HasBudget", 1, "HasActualCost", 0, "HasForecast", 0),
SELECTCOLUMNS(ActualCostFact, "ProjectID", ActualCostFact[ProjectID], "HasBudget", 0, "HasActualCost", 1, "HasForecast", 0),
SELECTCOLUMNS(ForecastFact, "ProjectID", ForecastFact[ProjectID], "HasBudget", 0, "HasActualCost", 0, "HasForecast", 1)
),
[ProjectID],
"HasBudget", MAX([HasBudget]),
"HasActualCost", MAX([HasActualCost]),
"HasForecast", MAX([HasForecast])
)
Create Relationships:
Create Measures for Filtering:
ProjectsWithBudget =
CALCULATE(
COUNTROWS(ProjectDim),
FILTER(
ProjectDim,
RELATED(ProjectMapping[HasBudget]) = 1
)
)
ProjectsWithForecast =
CALCULATE(
COUNTROWS(ProjectDim),
FILTER(
ProjectDim,
RELATED(ProjectMapping[HasForecast]) = 1
)
)
Create a Measure for Dynamic Filtering:
DynamicProjectFilter =
CALCULATE(
COUNTROWS(ProjectDim),
FILTER(
ProjectDim,
RELATED(TimeDim[FY]) IN VALUES(TimeDim[FY])
)
)
By following these steps, you should be able to achieve dynamic filtering across multiple fact tables based on user selection in Power BI.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
91 | |
90 | |
64 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
72 | |
68 |