Forum Discussion

seanpratt291's avatar
seanpratt291
Frequent Visitor
5 years ago
Solved

Need help with two columns for days between dates

I need two help with two columns here - hoping it's not a major issue.    Essentially what I need to do is understand two things 1) What is the time between the same product being purchased by the...
  • Ashish_Mathur's avatar
    Ashish_Mathur
    5 years ago

    Hi,

    These calculated column formulas work

    Days Since Last Purchase of Product = if(ISBLANK(CALCULATE(MAX(Data[Order Date]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Purchase #]<EARLIER(Data[Purchase #])))),BLANK(),Data[Order Date]-CALCULATE(MAX(Data[Order Date]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Purchase #]<EARLIER(Data[Purchase #]))))
    Days Since Last order = if(ISBLANK(CALCULATE(MAX(Data[Order Date]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Order #]<EARLIER(Data[Order #])))),BLANK(),Data[Order Date]-CALCULATE(MAX(Data[Order Date]),FILTER(Data,Data[Customer ID]=EARLIER(Data[Customer ID])&&Data[Order #]<EARLIER(Data[Order #]))))

    Hope this helps.