Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be 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

Reply
Anonymous
Not applicable

Avoiding circular dependencies in calculated columns

Hi all! I have a calculated column which I want to use in another calculated column.

 

My first calc column is below and sits in the "Date Table":

 

doesExist? = CALCULATE( if(ISBLANK(sum('Store'[DailyProfit]) ),"No","Yes"),CROSSFILTER('Date Table'[Datekey],'Store'[Date],Both))

 

Here I am checking to see when the last day a value was recorded in the "DailyProfit" column of another table "Store". A "Yes" is shown if a value was recorded on a specific date and "No" if not.

 

The second calc column also in "Date Table":

 

Target = 
var _1 = maxx(filter('Date Table',[isL7D?]="Yes"),'Date Table'[Datekey])
return
if('Date Table'[Datekey] >=_1-7 && 'Date Table'[Datekey]<=_1,"Yes","No")

 

Here I am trying to add "Yes" if the there is a "Yes" in the "doesExist?" column and is within the last 7 days of the last "Yes" (i.e. is within the last 7 days of a value being recorded in the "Store"[DailyProfit] column).

 

However, I receive the following error 

 

A circular dependency was detected: Date Table[doesExist?], Date Table[column], Date Table[doesExist?].

 

For example data please see my previous question

 

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi @Anonymous , 

You could try below expression to see whether it work or not.

Target = 
var _1 = maxx(filter('Date Table',RELATED('Table'[Value])<>BLANK()),'Date Table'[Datekey])
return
if('Date Table'[Datekey] >=_1-7 && 'Date Table'[Datekey]<=_1,"Yes","No")

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@Anonymous , refer if this can help

https://www.sqlbi.com/articles/avoiding-circular-dependency-errors-in-dax/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

hi @amitchandak, thank you for the resource. Whilst it was interesting I don't believe it helped with my problem as I can't seem to incorporate their solutions into my problem.

dax
Community Support
Community Support

Hi @Anonymous , 

You could try below expression to see whether it work or not.

Target = 
var _1 = maxx(filter('Date Table',RELATED('Table'[Value])<>BLANK()),'Date Table'[Datekey])
return
if('Date Table'[Datekey] >=_1-7 && 'Date Table'[Datekey]<=_1,"Yes","No")

 

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @dax that's it thank you! I had to slightly modify it as I had a one-to-many relationship between my Date Table and Values Table. So the DAX looked like this in the end:

 

Target = 
var _1 = maxx(filter('Date Table',sumx(RELATEDTABLE('Table'),'Table'[Value])<>BLANK(), 'Date Table'[Datekey])
return
if('Date Table'[Datekey] >=_1-6 && 'Date Table'[Datekey]<=_1,"Yes","No")

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.