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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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])

@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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors