Rockain
Rockain

Reputation: 5

How to get the delta between two date from the same column ? Power BI

My problem is in the question.

Here, a picture of my column on Power BI:

Exemple of my column

My goal is to have an other column like this:

this

Is there any way to do this ? With Excel this is trivial but I don't know how to do it with Power BI

Upvotes: 0

Views: 1042

Answers (1)

sirdoug9
sirdoug9

Reputation: 104

In order to access the previous row you will need to apply an index column when in query mode. Once you have an index column you will be left with your original datetime column and the index column.

If you then move to data view and add in a calculated column, to the pre-existing table, with the following formula:

IF('Table'[Index]=0,0,DATEDIFF('Table'[Column1],LOOKUPVALUE('Table'[Column1],'Table'[Index],
'Table'[Index]-1),MINUTE))

Please replace Column1 with your datetime column, alter the value that says "MINUTE" to the interval that you'd like to see the difference in.

Upvotes: 1

Related Questions