Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowTry your skills in the Power BI Dataviz World Championship! Round one ends June 26. Join now
I am getting strange results when using two tables connected with an active and an inactive connection.
Table 1: Calendar Date
Table 2: Opportunities with three relevant columns "Opportunities[Created Date], Opportunities[Closed Date], Opportunities[Opportunity Type]
and the two relationships between them
As part of a long calculation I am trying to find the last opportunity created in a certain period (the period will be selected on a visual by the user using Calendar[Date]).
My code:
To test: I set up filters on the page for (Calendar[Month] = 4) && (Calendar[Year] = 2018) to simulate the user using a slicer ( I actually have a slicer, I didn't want to complicate this post even further)
The results: on the left what the measure above returns and on the right the content of the Opportunities table.
Why does my formula return 4/18 as the maximun date when there are opportunities created up to 4/30?
I am almost certain that the issue is the combination of active and inactive relationships between the tables, but I haven't been able to figure out why. It's driving me insane.
Thanks for any advice,
Juan
Solved! Go to Solution.
Solved (Sort of)
I surrounded the whole thing with a
Calculate(
...
...,
USERELATIONSHIP (Calendar[Date], Opportunities[Created Date])
)
It now works, but I think this is ugly and I'd love to understand which part of the original measure was failing.
Solved (Sort of)
I surrounded the whole thing with a
Calculate(
...
...,
USERELATIONSHIP (Calendar[Date], Opportunities[Created Date])
)
It now works, but I think this is ugly and I'd love to understand which part of the original measure was failing.
@JuanOchoa what does this variable return, can you put it in the return?
VAR MaxDate =
CALCULATE (
MIN ( MAX ( Opportunities[Created Date] ), TODAY () ), // To avoid errors in case there are created dates after today
USERELATIONSHIP('Calendar'[Date], Opportunities[Created Date])
)
Learn about conditional formatting at Microsoft Reactor
My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
With the page filters that I have, it returns 2018/04/30
| User | Count |
|---|---|
| 24 | |
| 22 | |
| 22 | |
| 21 | |
| 13 |
| User | Count |
|---|---|
| 66 | |
| 56 | |
| 45 | |
| 45 | |
| 30 |