Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi, I'm new to PowerBI. I'm currently calculating using DAX to return the latest data from a table base on its ID, UniqueID and latest date .
At first, everything was fine, I managed to return a value from other table. As I proceed to other column, There's an error message about Circular Dependency. Is there any way to avoid the error? Here's the sample code from my data.
C34 =
VAR LastDayC34 =
CALCULATE (
MAX ( 'TX - Score Table'[Created] ),
NOT ISBLANK ( 'TX - Score Table'[C34] )
)
VAR LastUniqueIDC34 =
CALCULATE(
MAX('TX - Score Table'[ID]),
NOT ISBLANK('TX - Score Table'[C34]))
VAR LastIdC34 =
CALCULATE (
MAX ( 'TX - Score Table'[tag_id]),
'TX - Score Table'[Created] = LastDayC34,
'TX - Score Table'[ID] = LastUniqueIDC34,
NOT ISBLANK ( 'TX - Score Table'[C34] )
)
RETURN
CALCULATE (MAX('TX - Score Table'[C34]), 'TX - Score Table'[tag_id] = LastIdC34,'TX - Score Table'[ID]=LastUniqueIDC34)
C41 = VAR LastDayC41 =
CALCULATE (
MAX ( 'TX - Score Table'[Created] ),
NOT ISBLANK ( 'TX - Score Table'[C41] )
)
VAR LastUniqueIDC41 =
CALCULATE(
MAX('TX - Score Table'[ID]),
NOT ISBLANK('TX - Score Table'[C41]))
VAR LastIdC41 =
CALCULATE (
MAX ( 'TX - Score Table'[tag_id]),
'TX - Score Table'[Created] = LastDayC41,
'TX - Score Table'[ID] = LastUniqueIDC41,
NOT ISBLANK ( 'TX - Score Table'[C41] )
)
RETURN
CALCULATE (MAX('TX - Score Table'[C41]), 'TX - Score Table'[tag_id] = LastIdC41,'TX - Score Table'[ID]=LastUniqueIDC41)
I tried using other formula such as FILTER and MAXX but it was not sucessful.
Thank you for the Tips and Advice 😉
Solved! Go to Solution.
Hi,
The problem you are describing seems to be that you have two calculated columns containing calculate. This will cause issues due to context transition. This post by SQLBI explains this marvelously: "https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/"
The solution to your issue is to use ALLEXCEPT() within your CALCULATE.
I hope this helps to solve your issue and if it does consider accepting this as a solution!
Proud to be a Super User!
Hi @abdmajidnor,
Did ValtteriN 's suggestions help with your scenario? if that is the case, you can consider Kudo or accept his suggestions to help others who faced similar requirements.
If that also doesn't help, please share more detailed information to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Hi,
The problem you are describing seems to be that you have two calculated columns containing calculate. This will cause issues due to context transition. This post by SQLBI explains this marvelously: "https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/"
The solution to your issue is to use ALLEXCEPT() within your CALCULATE.
I hope this helps to solve your issue and if it does consider accepting this as a solution!
Proud to be a Super User!
Definitely didn't solve it. SQLBI did, as they so often do, but asking for kudos for a link is hardly a solution.
Here are a couple of links that actually work:
https://www.youtube.com/watch?v=m-qhcDcNKrE&ab_channel=SQLBI
Avoiding circular dependency errors in DAX - SQLBI
Definitely not asking to be marked as a solution since all I did was point those interested to the actual solution.
Here's my sample data, errors on circular dependency and desired value. Desired Data
Table 1
Dependency Error
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
15 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
22 | |
11 | |
10 | |
10 | |
8 |