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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.