Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Get last value in date column

Hello, I need to perform ISBLANK on a date column where there are blank values, so i thought to change the null values to 01/01/1000. But, i cant still use IF function to compare the MAX[DATE]-1 = ...
  • OliT's avatar
    OliT
    4 years ago

    Hi Anonymous 

    go to power query, add an index column, then use the column code below

     

    Column = 
    var _last=MAXX(FILTER('Table','Table'[Index]<EARLIER('Table'[Index]) && 'Table'[Column1]<>BLANK()),[Index])
    var _date=MAXX(FILTER('Table','Table'[Index]=_last),[Column1])
    return 
    IF(ISBLANK('Table'[Column1]),_date-'Table'[Index]+_last,'Table'[Column1])

     

    result

     

     

    Regards,

    OliT