Forum Discussion

sfalk781's avatar
sfalk781
Helper II
5 years ago
Solved

Rolling Last 3 Months Using Dates In Period

Hey everyone,    I'm using Dates in Period to look back to get the average of 3 days sales.  The measure looks correct to me but the numbers aren't adding up to the right amount.  In fact, if I cha...
  • Fowmy's avatar
    5 years ago

    sfalk781 

    Your granularity of the FactInternetSales21 table is not at day level, there are multiple records per dates. You need to summarize. to get the correct average

     

    Moving X Months Avg = 
    
    CALCULATE(
        AVERAGEX(
            SUMMARIZE(
                FactInternetSales21,
                FactInternetSales21[Order Date],
                "Amount",SUM(FactInternetSales21[Sales Amount])),
                [Amount]   
            ),
        DATESINPERIOD(
            FactInternetSales21[Order Date],
            LASTDATE(FactInternetSales21[Order Date]),-3,day)
    )

     

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn