Forum Discussion

abc_777's avatar
abc_777
Solution Specialist
3 years ago
Solved

hi

Hello,   I want to add Days since Last purchased (189 + 155 + 139) = 483 then divide it with Invoice Distinctcount (Summary) 3   as i have 3 indivisual invoice date. so 483/3 = 161 is his ave...
  • v-jianboli-msft's avatar
    3 years ago

    Hi abc_777 ,

     

    Based on your description, I have created a simple sample:

    Please try:

    Days Since last Purchase = SUMX(SUMMARIZE('bm_retail_t sale','bm_retail_t sale'[INVOICE_DT]),DATEDIFF( TODAY(),'1  Measure Table- Retail'[Day of Last Purchase],DAY))

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • v-jianboli-msft's avatar
    v-jianboli-msft
    3 years ago

    Hi abc_777 ,

     

    Please try:

    Days Since last Purchase = 
    SUMX(SUMMARIZE('bm_retail_t sale','bm_retail_t sale'[Customer],'bm_retail_t sale'[INVOICE_DT]),DATEDIFF(MAXX(FILTER(ALL('bm_retail_t sale'),[Customer]=EARLIER('bm_retail_t sale'[Customer])&&[INVOICE_DT]<EARLIER('bm_retail_t sale'[INVOICE_DT])),[INVOICE_DT]),'1  Measure Table- Retail'[Day of Last Purchase],DAY))

    Final output:

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.