Skip to main content
cancel
Showing results for
Search instead for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Helper I

## 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
Resolver III
2 REPLIES 2
Helper I

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
Resolver III

## Helpful resources

Announcements

#### Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

#### Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors