Forum Discussion

cplesner's avatar
cplesner
Helper III
9 years ago
Solved

Average Days between Orders

  Hi I'm trying to make a measure that shows the average days between orders from a specific Customer plus another measure that shows the average days between the orders of a specific Product from ...
  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    9 years ago

    Hi cplesner,

     

    You an also create calculated columns to calculate DateDiff values based for specific customer, or both customer and product. See:

     

    Previous-Customer = CALCULATE(MAX(Table1[Date]), (FILTER(Table1, EARLIER(Table1[Customer])=Table1[Customer] && EARLIER(Table1[Date])>Table1[Date])))

    DateDiff-C = DATEDIFF('Table1'[Previous-Customer],'Table1'[Date],DAY)

     

    Previous-PC = CALCULATE(MAX(Table1[Date]), (FILTER(Table1, EARLIER(Table1[Customer])=Table1[Customer] && EARLIER(Table1[Product])=Table1[Product] && EARLIER(Table1[Date])>Table1[Date])))

    DateDiff-PC = DATEDIFF('Table1'[Previous-PC],'Table1'[Date],DAY)

     

     

    Best Regards,
    Qiuyun Yu