Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

4Qrolling average

Hello,   I'm trying to calculate a 4Q rolling average based on my selling price, in the table 'Sell', the selling date are from the 09/01/2018 until today.      I looking for the average o...
  • Fowmy's avatar
    Fowmy
    2 years ago

    Anonymous 

    I created a file based on your data and added a calendar table as well. Please create this measure.

    4Q Rolling Avg = 
    
    CALCULATE(
        AVERAGEX(
            ADDCOLUMNS(
                DATESINPERIOD(
                    'Dates'[Date],
                    MAX('Dates'[Date]),
                    -4,
                    QUARTER
                ),
                "Price", CALCULATE(AVERAGE('Sell'[Price]))
            ),
            [Price]
        ),
        Sell[Selling Status] <> "Rejected",
        Sell[Type] <> "Out"
    )