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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
aukev
Helper III
Helper III

Avoiding a circular dependency when having a calculated column that references the other table

I have these two tables. Now I've added a calculated column to the Order table (see dax below).

The idea is that this is a best estimate of which call belongs to which order. This works fine but now I want to setup a relation between the two. Based on the historyID in Calls and the new calculated column with the history id in the orders table. This creates a circular dependecy. I think I understand why, but I don't now how to avoid this or how to go around it. I need to setup the relation to calculate cost/revenue for calls. Any ideas on how to go about this?

 

Calls   
callDateCustomer PhonehistoryID 
    
Order   
dateKeyorderIDPhonecallID
 


callID = CALCULATE( MIN(callDataIncoming[historyID]), FILTER ( CALCULATETABLE( VALUES (callDataIncoming)), DAY(callDataIncoming[callDate]) == DAY(magentoOrders[dateKey]) && MONTH(callDataIncoming[callDate]) == MONTH(magentoOrders[dateKey]) && YEAR(callDataIncoming[callDate]) == YEAR(magentoOrders[dateKey]) && callDataIncoming[Customer Phone] == magentoOrders[Phone] ) )

 

1 ACCEPTED SOLUTION
mauriciosotero
Resolver III
Resolver III

Now I've undertand.

 

You have to create a CallID in the two table. For the table Calls, the CallID will be the primary key, and in the Order table the CallID will be the foreing key.

 

In the Calls table, create a CallID like:

CallID = CONCATENATE(callDate, Customer Phone)

 

and in the Order table:

CallID = CONCATENATE(dateKey, Phone)

 

After thar, you can create the relationship.

View solution in original post

6 REPLIES 6
v-juanli-msft
Community Support
Community Support

Hi @aukev 

Is this problem sloved? 
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please let me know.
 
Best Regards
Maggie
v-juanli-msft
Community Support
Community Support

Hi @aukev 

You could create columns in "call" table

Column = CALCULATE(SUM('Order'[cost]),FILTER('Order','Order'[dateKey]=calls[callDate]&&'Order'[Phone]=calls[Customer Phone]))

Column 2 = CALCULATE(MIN(calls[historyID]),ALLEXCEPT(calls,calls[callDate],calls[Customer Phone]))

Capture5.JPGCapture6.JPG

Capture7.JPG
 
If it doesn't satisfy your requirement, please let me know.
 
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
mauriciosotero
Resolver III
Resolver III

Now I've undertand.

 

You have to create a CallID in the two table. For the table Calls, the CallID will be the primary key, and in the Order table the CallID will be the foreing key.

 

In the Calls table, create a CallID like:

CallID = CONCATENATE(callDate, Customer Phone)

 

and in the Order table:

CallID = CONCATENATE(dateKey, Phone)

 

After thar, you can create the relationship.

Hi, thanks. The problem is that there can be multiple calls on the same day and these are not necessarily connected with an order.

So creating a call id like that on the calls table will create multiple calls ids that are the same.

 

But then again maybe it's okay if these have the same id as multiple calls to the same customer probably mean that it's about the same order.

mauriciosotero
Resolver III
Resolver III

Hi,

 

It would be much better with you create in your model a relationship between the two tables.

The problem is with just a relationship I wouldn't know which call belongs to which order. I'd have to match these first by checking the date and call extention. Or am I missing something?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors