Forum Discussion

BilboBaggins's avatar
BilboBaggins
Frequent Visitor
8 years ago
Solved

Days between based on slicer

Greetings! I have table that has several lines of startdate and enddate. I can easily calculate a new colun that shows the number of days between startdate and enddate, but in the next step I'm bi...
  • Anonymous's avatar
    Anonymous
    8 years ago

    BilboBaggins,

    You can create the following measure. For more details, please check attached PBIX file.

    Datediff = var maxslicer=MAX('Date'[Date]) var minslicer=MIN('Date'[Date]) return CALCULATE(
        DATEDIFF(
            IF(MAX(person[startDate]) < minslicer;minslicer;MAX(person[startDate]));
            IF(MAX(person[endDate]) > maxslicer;maxslicer;MAX(person[endDate]) );
            DAY)
    )



    Regards,
    Lydia