Forum Discussion

tracytran91's avatar
tracytran91
Icon for Helper III rankHelper III
5 years ago
Solved

Average last 3 Months with Distinct Value

Hi Friends,    I need to calculate the average last 3-Month distinct store ordered our product.  Our product just released in March.  I tried the calculation using DATESINPERIOD Or DATEBETWEEN bu...
  • v-xulin-mstf's avatar
    v-xulin-mstf
    5 years ago

    Hi tracytran91,

     

    Sorry for delay reply.

    Try measure as:

    Measure = 
    var curr_month=SELECTEDVALUE('Table'[Month])
    var temp=
    AVERAGEX(
       FILTER(
        ALLSELECTED('Table'[Month]),
        'Table'[Month]<curr_month&&'Table'[Month]>=curr_month-3
         ),
        DISTINCTCOUNT('Table'[Store Code]))
    return temp

     The pbix is attached.

     

    If you still have some question, please don't hesitate to let me known.‌‌

     

    Best Regards,

    Link

     

    Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!