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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Hennie7863
Frequent Visitor

Leadtime between time and certain conditions

Hi,

 

Question about calculating Leadtimes between certain moments in time with a condition. 

 

I've included an example  :

 

Leadtime.png

 

I have indicators that determines the start of a new phase per process. So I have to determine the time for phase 1 and phase 2. I can't assign the phase to certain processsteps because the end of phase and the start of the next phase is determined by the same processtep.

 

Hennie

3 REPLIES 3
Eric_Zhang
Microsoft Employee
Microsoft Employee

@Hennie7863

You can create two calculated columns. See more in the attached pbix file.

phase2 proceStepID =
MINX (
    FILTER (
        FILTER ( yourTable, EARLIER ( yourTable[ProcesID] ) = yourTable[ProcesID] ),
        yourTable[Phase2] = 1
    ),
    yourTable[ProcesStepID]
)
phases =
SWITCH (
    TRUE (),
    yourTable[ProcesStepID] <= yourTable[phase2 proceStepID], "phase1",
    "phase2"
)

Capture.PNG

Hi Eric,

 

Thank you for the proposed solution. Much appreciated. 

 

Although it 's in the right direction, It seems that the values for for procesID 3 and 4 are not correct. There are values for ProcesID 3 and 4 and those should be 0. 

 

If I expand the example with some more phases, the MINX-FILTER-FILTER DAX expression is only working for two phases, IMO. But in my reallife scenario I have multiple phases (to be exact 5 phases).

 

So I thought to create separate columns for calculation of time for phase1, phase2, phase3, etc, But that will give me a circular dependenc error

 

EndProcesStepID =
MINX (
FILTER (
FILTER ( FactProces, EARLIER ( FactProces[ProcesID] ) = FactProces[ProcesID] ),
FactProces[End] = 1
),
FactProces[ProcesStepID]
)

 

 

 

 =
SWITCH (
TRUE (),
FactProces[ProcesStepID] <= FactProces[EndproceStepID], [SumTimeInSec]
)

 

 

A circular dependency was detected: 'FactProces'[CalculatedColumn1],'FactProces'[CalculatedColumn1],'FactProces'[Phase1],'FactProces'[Phase1],'FactProces'[CalculatedColumn1].

 

Multiple phases.png

 

 

Thanks again.

 

Hennie

 

ps. Maybe i can avoid the cirular dependency error by determing the processteps in my SQL query...

Hi Eric,

 

Thank you for the proposed solution. Much appreciated. 

 

Although it 's in the right direction, It seems that the values for for procesID 3 and 4 are not correct. There are values for ProcesID 3 and 4 and those should be 0. 

 

Thanks again.

 

Hennie

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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 (4,368)