0
I have the following problem..
I have the following table:
I want to create a calculated column that tells me the difference of days between two dates of the same code (COD), the difference shall be calculated based on the previous date of the line. For example:
Using the COD B
COD | DATE | Days of Difference
B |05/01/2018 |
B |09/01/2018 | 4
B |12/01/2018 | 3
In the image example the codes/dates are ordered in sequence, but in reality they are out of order.
I tried using the following sentence on DAX:
DATEDIFF(Testing[DATE]; FIRSTDATE(FILTER( ALL(Testing[DATE]) ;Testing[DATE] > EARLIER(Testing[DATE])));DAY)
Explaining what I tried: Make the difference between the date on the line and using the function EARLIER catch the latest date off the current.
However, I got the following result:
I’m not getting to put as filter the COD, so that the analysis of 'EARLIER' is performed only in the same 'group', so I understand Powerbi is considering all dates.
Any idea?