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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Subtraction of 2 time rows

Hello all,

 

I have a "Tarih.2 (hour:minute:sec)" column in my database and I want to subtract each pair of values in this column.

For example; row2-row1, row4-row3, row6-row5 etc..

After this operation, I need keeps these values into new column.

 

How can I do this? 

 

ernu_0-1635942324684.png

 

Thanks a lot in advance.

 

1 ACCEPTED SOLUTION

Hi @Anonymous ,

 

So, with your table in Power Query, you would select the [Index.1] column, then go to the Home tab and select Merge.

In the dialog, you would use the same table for both the left and right members of the merge i.e. you are joining/merging the table on itself:

BA_Pete_0-1636015638170.png

 

When the merge completes, you will have a column full of nested tables. Expand these tables by hitting this button:

BA_Pete_1-1636015728602.png

 

And select just your [Tarih.2] column from the list:

BA_Pete_2-1636015794157.png

 

This should give you a table like this where the previous [Tarih.2] value is on the same row as the current value:

BA_Pete_3-1636015903742.png

 

This now makes it really easy to do comparisons of the two values on each row.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @BA_Pete ,

 

Actually, I couldn't fully understand. Can you explain as more detail?

 

Thanks a lot,

Eren

Hi @ernu ,

 

So, with your table in Power Query, you would select the [Index.1] column, then go to the Home tab and select Merge.

In the dialog, you would use the same table for both the left and right members of the merge i.e. you are joining/merging the table on itself:

BA_Pete_0-1636015638170.png

 

When the merge completes, you will have a column full of nested tables. Expand these tables by hitting this button:

BA_Pete_1-1636015728602.png

 

And select just your [Tarih.2] column from the list:

BA_Pete_2-1636015794157.png

 

This should give you a table like this where the previous [Tarih.2] value is on the same row as the current value:

BA_Pete_3-1636015903742.png

 

This now makes it really easy to do comparisons of the two values on each row.

 

Pete

Hi @Anonymous ,

 

So, with your table in Power Query, you would select the [Index.1] column, then go to the Home tab and select Merge.

In the dialog, you would use the same table for both the left and right members of the merge i.e. you are joining/merging the table on itself:

BA_Pete_0-1636015638170.png

 

When the merge completes, you will have a column full of nested tables. Expand these tables by hitting this button:

BA_Pete_1-1636015728602.png

 

And select just your [Tarih.2] column from the list:

BA_Pete_2-1636015794157.png

 

This should give you a table like this where the previous [Tarih.2] value is on the same row as the current value:

BA_Pete_3-1636015903742.png

 

This now makes it really easy to do comparisons of the two values on each row.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




BA_Pete
Super User
Super User

Hi @Anonymous ,

 

It looks like you're already halfway through the solution I would propose in that you've got two index columns offset by 1.

I would merge your table on itself as table[Index.1] = table[Index] and expand the [Tarih.2] column after the merge.

You then have the two times inline on the same row to make the subtraction on using Duration functions or whatever method you choose.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors