Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Count Days Between Two Dates in Same Column

I am building reports in powerbi using an established data model where the security in place prevents the ability to add columns; thus I must develop a measure to calculate the number of days between...
  • FreemanZ's avatar
    FreemanZ
    3 years ago

    hi Anonymous 

    Try to plot a table visual with UniqueIdentifier and a measure like:
    daysbetween =
    VAR _date = MAX(TableName[EventDate])
    VAR _datepre =
    MAXX(
       FILTER(
          ALL(TableName[EventDate]),
          TableName[EventDate]<_date
       ),
      TableName[EventDate]
    )
    RETURN
    DATEDIFF(_datepre, _date, DAY)