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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Student59
New Member

Time column

I need help.

I have a column for the hours of production.

I want to calculate the time difference between them and create a new column.

In this way, I will create a cycle time chart.

What formula should I use to create this column?

veri.png

2 REPLIES 2
Anonymous
Not applicable

Hi, @Student59 

 

Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1708576564035.png

 

DAX:

New Column:

DateDown =

VAR _dateDown =

    CALCULATE (

        MAX ( 'Date'[Date] ),

        FILTER ( 'Date', 'Date'[Date] < EARLIER ( 'Date'[Date] ) )

    )

RETURN

    _dateDown

 

Measure:

TimeDiff =

VAR _date1 =

    SELECTEDVALUE ( 'Date'[Date] )

VAR _date2 =

    SELECTEDVALUE ( 'Date'[DateDown] )

VAR _diff_second =

    DATEDIFF ( _date2, _date1, SECOND )

VAR Hours =

    INT ( _diff_second / 3600 )

VAR Minutes =

    INT ( MOD ( _diff_second, 3600 ) / 60 )

VAR Seconds =

    MOD ( _diff_second, 60 )

RETURN

    IF (

        NOT ISBLANK ( _date2 ),

        FORMAT ( Hours, "00" ) & ":"

            & FORMAT ( Minutes, "00" ) & ":"

            & FORMAT ( Seconds, "00" )

    )


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

Thanks but A chart cannot be created with this value.

I want to create a chart like below with this value.graph.png

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors