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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Menvf
Frequent Visitor

Using different relationships in a iterative function

Hi Guys!

 

I need to use different relationships within the same iterative function.

What I need is the below calculation, however where the all('Invoice Line');all('Purchase Order') only is applied to [Finished demand per bag]

 

calculate(sumx(mainReseptitSQL;mainReseptitSQL[Finished demand per bag]*([CM Kg price after reduced]/[CM Yield])*[CM Sold No of Bags]);all('Invoice Line');all('Purchase Order')
 
Thank you in advance
2 REPLIES 2
Menvf
Frequent Visitor

Another attempt was made, what is weird is that the filtercontext added in the variable is removed when used in the return. All measures work like intended when used seperately.

TEST CM Total Cost Sold Bags = 
var Finished_demand_per_bag = calculate(sumx(mainReseptitSQL;mainReseptitSQL[Finished demand per bag]);all('Invoice Line');all('Purchase Order'))

return 
sumx(mainReseptitSQL;Finished_demand_per_bag *([CM Kg price after reduced]/[CM Yield])*[CM Sold No of Bags])

 

 

Menvf
Frequent Visitor

I tried making a measure of the first

[Finished demand per bag]

 

So it went like this

CM Finished demand per bag = calculate(sumX(mainReseptitSQL;mainReseptitSQL[Finished demand per bag]);all('Purchase Order');all('Invoice Line')) 

 

Then I nested it so it looked like this.

TEST CM Total Cost Sold Bags = calculate(sumx(mainReseptitSQL;mainReseptitSQL[CM Finished demand per bag]*([CM Kg price after reduced]/[cm Yield])*[CM Sold No of Bags]))

 

Each individual measure gives me a the expected value. However, when I put them all in the same measure I get unexpected results as if the first filter context in the first measure wasn't there.

 

 

 

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.