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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

For looping in DAX to calculate starting dates according to end dates of tasks

Hello community, 

 

I'm trying to build a GANTT view in my Power BI Report using tasks durations and prerequisites. I need to calculate the starting date of an operation according to the end date of its prerequisites (that is not usually unique). You can find below the content of my table:

I set up a starting date of the first task to 1 september using the DAX code : 

start = IF(Jointure[bool]=="vrai";[debutprojet])
Then I calculated the end date using this formula : 
end = Jointure[start]+(Jointure[duree_operation]/8)
I tried the following formula for calculating the remaining start dates :
start = IF(Jointure[bool]=="vrai";[debutprojet];LOOKUPVALUE(Jointure[end];Jointure[operationID];Jointure[prerequisID]))
Unfortunatly, a circular dependency wad detected. 
How can I loop 2 times through operationsID and prerequisites to find at each iteration the maximum value of an operation prerequisites end date ?
 
 Thanks for your help ! 

maroua_sbiti_1-1631284535637.png

 

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Anonymous Well, you can do emulated FOR and WHILE loops in DAX. 

https://community.powerbi.com/t5/Quick-Measures-Gallery/For-Loop/m-p/637531#M319

https://community.powerbi.com/t5/Quick-Measures-Gallery/While-Loop/m-p/637535#M320

Recursion or previous value is very difficult

https://community.powerbi.com/t5/Quick-Measures-Gallery/Previous-Value-aka-quot-Recursion-quot/m-p/637614#M321

 

However, I'm not sure exactly what you want. Can you post sample data as text and expected output?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Please refer to the picture above: 

 

Operation1 doesn't have any prerequisite so it should take the starting date of the project that I've introduced as a measure. 

Operation 2 has one prerequisite (which is operation 1) should start at the end of operation 1. It ends at end of operation 1 +duration of operation 2 

Same thing for operation 3 it follows operation 2 so it shoul start at the end date of operation 2 and it will finish 3 days after because the  execution of operation takes 21 hours (8 working hours a day)

....

operation 11 has two prerequisites 9 and 10, so its starting date will be the max finish date of 9 and 10.

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric 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.

Users online (25)