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
StephenK
Resolver I
Resolver I

Circular Dependency on Calculated Column

I'm knocking my head against a wall because of a circular dependency error I am getting on a calculated column.

 

Annotation 2020-04-23 093249.png

I'm trying to add two calculated columns to my provider schedule table. I can add one, but when I try to add the second it throws an error.

 

1.

 

COVIDAdjustedSlots =
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[COVIDScheduledSlots]-[COVIDAdminDaySlotAdjustment]),
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[COVIDScheduledSlots]-[COVIDAdminDaySlotAdjustment]),
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[COVIDScheduledSlots]-[COVIDAdminDaySlotAdjustment]),
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[COVIDScheduledSlots]-[COVIDAdminDaySlotAdjustment]),'Provider Schedule'[COVIDScheduledSlots]))))

 

2.

 

AdjustedSlots = IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[ScheduledSlots]-[AdminDaySlotAdjustment]),
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[ScheduledSlots]-[AdminDaySlotAdjustment]),
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[ScheduledSlots]-[AdminDaySlotAdjustment]),
IF('Provider Schedule'[ResourceId]=********,('Provider Schedule'[ScheduledSlots]-[AdminDaySlotAdjustment]),'Provider Schedule'[ScheduledSlots]))))
 
 
[COVIDScheduledSlots] and [ScheduledSlots] are columns added through Power Query.
[AdminDaySlotAdjustment] and [COVIDAdminDaySlotAdjustment] are both measures based on Provider Schedule table and the related table Admin_Days
 
 
AdminDaySlotAdjustment = (SUM(Admin_Days[AdminDaysPerWk])*(([Workdays]/5)/[Workdays]))*SUM('Provider Schedule '[ScheduledSlots])
 
COVIDAdminDaySlotAdjustment = (SUM(Admin_Days[AdminDaysPerWk])*(([Workdays]/5)/[Workdays]))*SUM('Provider Schedule'[COVIDScheduledSlots])
 
Any help is greatly appreciated.
 
 

 

 
1 ACCEPTED SOLUTION
StephenK
Resolver I
Resolver I

So the problem seems to be that my calculated column was referencing a measure which also referenced a column in that same table. 

 

I found the easiest way to fix the problem was to rewrite the measure AdminDaySlotAdjustment into a calculated column:

 

IF('Provider Schedule'[ResourceId] IN {******},(.5/5)*'Provider Schedule'[ScheduledSlots],BLANK())
 
I then changed the calculated columns COVIDAdjustedSlots and AdjustedSlots to reference the calculated column above instead of the original measure I had. 
 
 
I don't think this is the ideal solution. Seems more like a quick and dirty fix to get my model to do what I needed it to. If anyone has a more elegant solution I'm all ears.

View solution in original post

2 REPLIES 2
StephenK
Resolver I
Resolver I

So the problem seems to be that my calculated column was referencing a measure which also referenced a column in that same table. 

 

I found the easiest way to fix the problem was to rewrite the measure AdminDaySlotAdjustment into a calculated column:

 

IF('Provider Schedule'[ResourceId] IN {******},(.5/5)*'Provider Schedule'[ScheduledSlots],BLANK())
 
I then changed the calculated columns COVIDAdjustedSlots and AdjustedSlots to reference the calculated column above instead of the original measure I had. 
 
 
I don't think this is the ideal solution. Seems more like a quick and dirty fix to get my model to do what I needed it to. If anyone has a more elegant solution I'm all ears.
jthomson
Solution Sage
Solution Sage

Don't know about your problem, but the DAX would be tidier and probably quicker if you do something like if ([ResourceId] in {value1, value2, value3} rather than a huge nested if

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.