Forum Discussion

mtrevisiol's avatar
mtrevisiol
Helper V
4 years ago
Solved

Days between two dates in different rows

Hi everyone, I've got a table that contains the price list of some products that my company buys from a certain supplier: For each item there are the start date and the end date of the price ...
  • HotChilli's avatar
    4 years ago

    A calculated column in DAX:

    ColumnZ = var _item = 'Table'[Item]
    var _endDate = 'Table'[ValidityEndingDate]
    RETURN
    CALCULATE(MIN('Table'[ValidityStartingDate]), FILTER('Table', 'Table'[Item] = _item && 'Table'[ValidityStartingDate] > _endDate))

    You can then use DATEDIFF in another column to get the days between the column and the ending date.

    I haven't really tested it so please do that.