Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hey there
I cannot find a solution to my problem. I hope there is somebody who can help me.
I have two fact tables that I cannot combine into one because in the real data model it is just not possible.
Sales and Cost tables are fact table and are linked through Month and Country dim tables
Country A for 11-2019 does not have Cost and Country B does not have Sales for 12-2019.
How can I implement a page filter where we only display values where there are Sales and Cost? So in this example, we should only have:
Here is the link to PBIX File
Thanks for the help
Solved! Go to Solution.
Hi @ignas
Create measures
Measure flag = IF(SUM(Fact_sales[Sales])<>BLANK()&&SUM(Fact_cost[Cost])<>BLANK(),1,0)
Measure sales = CALCULATE(SUM(Fact_sales[Sales]),FILTER(Fact_cost,[Measure flag]=1))
Measure cost = CALCULATE(SUM(Fact_cost[Cost]),FILTER(Fact_cost,[Measure flag]=1))
Hi @ignas
you need to wrap a CALCULATE around the sum to transfer the row context from the SUMX into a filter context:
IF = SUMX(dimCustomer,
IF(CALCULATE(sum(fact_open[amount]))=BLANK(),BLANK(),[Sum Revenue]))
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @ignas
Create measures
Measure flag = IF(SUM(Fact_sales[Sales])<>BLANK()&&SUM(Fact_cost[Cost])<>BLANK(),1,0)
Measure sales = CALCULATE(SUM(Fact_sales[Sales]),FILTER(Fact_cost,[Measure flag]=1))
Measure cost = CALCULATE(SUM(Fact_cost[Cost]),FILTER(Fact_cost,[Measure flag]=1))
@v-juanli-msft
You helped me the last time to find a solution. I was just trying to find another solution and I am very close. I use SUMX, but I get wrong Total value:
File can be found here:
Power BI File
Hi @ignas
you need to wrap a CALCULATE around the sum to transfer the row context from the SUMX into a filter context:
IF = SUMX(dimCustomer,
IF(CALCULATE(sum(fact_open[amount]))=BLANK(),BLANK(),[Sum Revenue]))
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
@ImkeF You are absolutely amazing. It indeed works. Thank you very much. I am just completely confused what in this case "calculate" does. If I remove calculate then I get the wrong answer.
I always use calculate then I need to filter something: Calculate(sum(metrics); dim=x)
But you just wrapped sum with "calculate". So in my mind, it should not be a difference with calculate and without. I would highly appreciate if you could elaborate on this.
Hi @ignas
this article has a good explanation for it: https://www.sqlbi.com/articles/understanding-context-transition/
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Hi @ignas
you need a measure that checks for blanks in the other table and then return blank itself like so:
Measure = if(ISBLANK(Sum(Fact_cost[Cost])),BLANK(), SUM(Fact_sales[Sales]))
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Your measure will only work in the table, but not in the Card as shown above. With your formula, I get the same results.
Ideally, I need a filter where I could filter the whole page. Any ideas if it is possible?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 78 | |
| 48 | |
| 35 | |
| 31 | |
| 27 |