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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Varan_15
Helper III
Helper III

Time Difference based by workstep wise

Hi All,

 

I have data which is contains workstep (input, process, rejected, completed) i want to calculate the time differences between
(first input entry time - last completed exit time )

 

Example: same i have to get for each ID - highlighted expected result as below

33333.PNG

 

 

Thanks,

Varan

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your data model looks like, but please check the below picture and the attached pbix file.

It is for creating a measure.

 

Jihwan_Kim_0-1672648240607.png

 

 

total minutes took measure: =
VAR _entrymin =
    MIN ( Data[Entry time] )
VAR _exitmax =
    MAX ( Data[Exit time] )
RETURN
    IF ( HASONEVALUE ( Data[ID] ), DATEDIFF ( _entrymin, _exitmax, MINUTE ) )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Hi @Jihwan_Kim ,

 

I need to create calculated column if use above mentioned dax it's taking entire data in min/ max values but i need only workstep  input - min entry date - completed max exit date

 

Thanks

Hi,

Please check the below picture and the attached pbix file.

It is for creating a new column.

 

Jihwan_Kim_0-1672660902879.png

 

 

Total minutes took CC =
VAR _inputentrymin =
    MINX (
        FILTER ( Data, Data[ID] = EARLIER ( Data[ID] ) && Data[Workstep] = "Input" ),
        Data[Entry time]
    )
VAR _completeexitmax =
    MAXX (
        FILTER ( Data, Data[ID] = EARLIER ( Data[ID] ) && Data[Workstep] = "Completed" ),
        Data[Exit time]
    )
RETURN
    IF (
        Data[Workstep] = "Completed",
        DATEDIFF ( _inputentrymin, _completeexitmax, MINUTE )
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

lin_k
New Member

Hi @Varan_15 

 

in this case you can follow the lined out steps:

1. Select Datatype as Date & Time (you can do this by right-clicking on the header of the column)

2. Add a custom row where you subtract Entry from Extract time, simply do this by using "-" and writing a formular

lin_k_0-1672648199805.png

 

3. Format the result of your custom column as you need it 

 

Let me know if this helps 🙂

Helpful resources

Announcements
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.