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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Aleph18
Frequent Visitor

Calculate average future price by contract in a many to many relationship

Hi,

 

I need help please to calculate a column of average future price by contract  (many to many relationship) between two dates. 

 

Aleph18_0-1622491655318.png

 

Aleph18_3-1622491886773.png

 

 

Aleph18_2-1622491769179.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Remove the relationship between the 2 tables.  Write this calculated column formula in CAKstartEndDates table

=calculate(average(Benchmark[value]),filter(benchmark,benchmark[value]>=earlier(CAKstartEndDates[Start date])&&benchmark[value]<=earlier(CAKstartEndDates[End date])&&benchmark[FUT]=earlier(CAKstartEndDates[Future])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Remove the relationship between the 2 tables.  Write this calculated column formula in CAKstartEndDates table

=calculate(average(Benchmark[value]),filter(benchmark,benchmark[value]>=earlier(CAKstartEndDates[Start date])&&benchmark[value]<=earlier(CAKstartEndDates[End date])&&benchmark[FUT]=earlier(CAKstartEndDates[Future])))

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Nathaniel_C
Community Champion
Community Champion

Hi @Aleph18 , It is not a best practice to connect two tables with a many to many relationship.  Instead create a calendar table which will allow you to connect the two tables by a 1 to * relationship from the calendar table to each table.
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors