Forum Discussion

ehwood's avatar
ehwood
Regular Visitor
8 years ago
Solved

Finding Time Between Dates Based on ID

Hello Experts of the Power BI Community,   Please go easy on me as I'm new with DAX. I hope this isn't a terrible question, but I've been struggling to come up with a solution to my problem.   I ...
  • Ashish_Mathur's avatar
    8 years ago

    Hi,

     

    This calculated column formula works.  You may download my PBIX file from here.

     

    =if(ISBLANK(CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Date]<EARLIER(Data[Date])))),BLANK(),[Date]-CALCULATE(MAX(Data[Date]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Date]<EARLIER(Data[Date]))))

     

    Hope this helps.