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
Joe_Grosskopf
Helper II
Helper II

Circular Dependancy with If statement

I can't understand where my dependancy is. I have 4 measures for running total...

 

RT_800-1Dir =
            VAR __date = max('Dept 800-1 Daily Time'[Date_Began])
            VAR __Table = FILTER(ALLSELECTED('Dept 800-1 Daily Time'),'Dept 800-1 Daily Time'[Date_Began] <= __date )
            return
            sumx(__Table,[Direct])
 
RT_800-1Indirect =
            VAR __date = max('Dept 800-1 Daily Time'[Date_Began])
            VAR __Table = FILTER(ALLSELECTED('Dept 800-1 Daily Time'),'Dept 800-1 Daily Time'[Date_Began] <= __date )
            return
            sumx(__Table,[Indirect Time])
 
RT_800-2Dir =
            VAR __date = max('Dept 800-2 Daily Time'[Date_Began])
            VAR __Table = FILTER(ALLSELECTED('Dept 800-2 Daily Time'),'Dept 800-2 Daily Time'[Date_Began] <= __date )
            return
            sumx(__Table,[Direct])
 
RT_800-2Indirect =
            VAR __date = max('Dept 800-2 Daily Time'[date_began])
            VAR __Table = FILTER(ALLSELECTED('Dept 800-2 Daily Time'),'Dept 800-2 Daily Time'[date_began] <= __date )
            return
            sumx(__Table,[Indirect Time])
 
I then have a table with two columns showing the RT
 
The RTDir column works fine
RT_Dir = if([Dept]="800-1",[RT_800-1Dir],if([Dept]="800-2",[RT_800-2Dir],0))
 
However the RTInd is giving me an error
RT_InDir = if([Dept]="800-1",[RT_800-1Indirect],if([Dept]="800-2",[RT_800-2Indirect],0))
 
<ccon>A circular dependency was detected: Combined Time 800[Column], Combined Time 800[RT_Dir], Combined Time 800[Column].</ccon>
 
I cannot figure out why one works and the other does not
 
Thank You
 
1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Joe_Grosskopf ,

In your case, Power BI does not allow to have two calculated columns that contain measures that are also based on that table.  In order to understand why, you'd need a better understanding of what's going on under the hood.

Refer:

https://www.sqlbi.com/articles/understanding-circular-dependencies/ 

vluwangmsft_0-1664437621932.png

 

 

Best Regards

Lucien

View solution in original post

2 REPLIES 2
Joe_Grosskopf
Helper II
Helper II

I managed to get it working...Thank YOU

v-luwang-msft
Community Support
Community Support

Hi @Joe_Grosskopf ,

In your case, Power BI does not allow to have two calculated columns that contain measures that are also based on that table.  In order to understand why, you'd need a better understanding of what's going on under the hood.

Refer:

https://www.sqlbi.com/articles/understanding-circular-dependencies/ 

vluwangmsft_0-1664437621932.png

 

 

Best Regards

Lucien

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.