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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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