cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
parminderkellah
Frequent Visitor

7 Days Rolling Average between 2016-2020

Hi Experts

 

The below measure gives me the correct average calculation for the period 2016-2020. How do i get the 7 day rolling average between thsoe dates


my Measure =

2016-20 Average =
VAR _A =  SELECTEDVALUE(DimDate[Day of Year])
RETURN
        CALCULATE(
                Average('ce DemandDestructionSimple'[Value]),
                    DimDate[Day of Year] = _A,
            DimDate[Year] >= 2016 && DimDate[Year] <= 2020,
    ALL( DimDate )
)
1 ACCEPTED SOLUTION
2 REPLIES 2
parminderkellah
Frequent Visitor

My new Measure

7 Days Rolling Average (2016-20) =
VAR _A =  SELECTEDVALUE(DimDate[Day of Year])
VAR _Rolling=  CALCULATE(
                Average('ce DemandDestructionSimple'[Value]),
                    DimDate[Day of Year] = _A,
            DimDate[Year] >= 2016 && DimDate[Year] <= 2020,
                                ALL( DimDate )
        )
VAR _Result =
        CALCULATE(_Rolling,
             DATESINPERIOD(DimDate[Date],LASTDATE(DimDate[Date]),-7,DAY))
Return
    _Result

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.