cancel
Showing results for
Search instead for
Did you mean:
Highlighted
Resolver IV

## Rolling Average Quick Measure - Have I done this correctly?

Hi all,

I'm using the rolling average quick measure for the first time and I just wanted to sense check that it worked correctly. I need a rolling 7 day average, so do I need to select -6 or -7? And should the second part of the DATEADD(_last date be a 0 or a 1?

Spoiler
Count of EventType rolling average =
IF(
ISFILTERED('Date'[Date]),
ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
VAR __LAST_DATE = LASTDATE('Date'[Date].[Date])
RETURN
AVERAGEX(
DATESBETWEEN(
'Date'[Date].[Date],
DATEADD(__LAST_DATE, -7, DAY),
DATEADD(__LAST_DATE, 0, DAY)),
CALCULATE(COUNTA('Agent Data'[EventType]))))

Kind regards,

Jordan

1 REPLY 1
Highlighted
Super User IX

## Re: Rolling Average Quick Measure - Have I done this correctly?

@jme1calff , Have you tried like

Rolling 7 day = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],MAX(Sales[Sales Date]),-7,Day))

or like

Rolling 3 till last 2 Day= CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(dateadd(Sales[Sales Date],-2,Day)),-3,Day))

Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

## Helpful resources

Announcements

#### August Community Highlights

Check out a full recap of the month!

#### August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

#### Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors