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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
ErikOmni
Helper I
Helper I

Circular dependancy: Can't figure out why it occurs..

Hi!

 

So I'm stuck with a circular dependancy that I cant figure out. I'm working on some order data and trying to allocate costs down to order row level. I first allocated a base rate per order down to order row level (worked fine), then I'm trying to apply same logic to shipping cost, however, that's when I get a circular reference I don't understand.

 

Key measures:

 

Total order rows per order =
  VAR __id = calculate(max('Sales'[order_id]), filter(Sales,Sales[sale_line_type]="product"))


  VAR __skus = FILTER(ALLSELECTED('Sales'),[variant_sku] <> BLANK() && [order_id] = __id)
RETURN
  COUNTROWS(__skus)
 
Order cost per row = calculate(divide(Pick_Pack[Pick&Pack base rate per order], [Total order rows per order])

)
 
ErikOmni_0-1662031098380.png

 

 

Pick&Pack costs and Shipping costs have no overlap so the issue seems to be Total order rows per order.

 

Any thoughts?

 

Thanks! 

2 REPLIES 2
amitchandak
Super User
Super User

@ErikOmni , Create a measure using the measure. Do not use them in calculated column

 

You can do line level calculation like

 

Sumx(Table, [Measure1]+ [Measure2])

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

@amitchandak I'm afraid this doesn't really help me. Not sure even where to start.

 

First of all, measures uses different tables. (total rows per order uses Order Data table for example). 

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.