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
Pamplemousse
New Member

Please help to calculate delays between three dates of three different table

Hello,

i'm beginner in power bi et trying to calculate delays between three dates of three different table.

Pamplemousse_1-1651066887589.png

Each "n° op" may have severals "commandes" and each "commande" may have severals "reception". I'd like to calculate the mean delay between "date de commande" and "date de mad finale", and "date de mad finale" and "date de reception". The "date de mad finale" is unique per "n° op". 

My mesures : 

Délais MAD-Commande = datediff(LASTDATE(Commandes[Date de commande]),LASTDATE(MOE_FINAL[Date de MAD Finale]),DAY)
Délais Réception-MAD = datediff(LASTDATE(MOE_FINAL[Date de MAD Finale]),LASTDATE('Réceptions'[Date de réception]),DAY)
They are not working at all, it shows dates of "commandes" that are not even related to "n° Op".
Pamplemousse_2-1651067347357.png

Could you please help ? 

 

7 REPLIES 7
johnt75
Super User
Super User

You could try

Delay MAD-Commande = AVERAGEX(Commandes,
DATEDIFF( Commandes[Date de commande], RELATED(MOE_final[Date de MAD]), DAY)
)

Delay Reception - MAD = AVERAGEX(Receptions,
DATEDIFF( RELATED(MOE_Final[Date de MAD]), Receptions[Date de reception], DAY)
)

Thank you for your help, but i doesn't seem to work, something still goes wrong 

Pamplemousse_0-1651071842242.png

 

Those all have the same No OP, so they would have the same average for MAD- commande. For the other one, you may need to swap the order of the dates in DATEDIFF

The problem is, for exemple, the first op_0012 has only one "commande", i don't know why it shows all the others 

which table is No Commande - No Poste  in the visual coming from, it seems to exist in 2 tables in the model?

It comes frome "Commandes" table, but i tried with the one of "Receptions" table, nothing changed.

Is it possible to share a PBIX with any confidential information blanked out? 

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
Top Kudoed Authors