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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

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

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

 

You can do line level calculation like

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.