Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hello - I am trying to use a DAX function to calculate the rolling average of Google Analytics sessions with a custom date range. I use the following function:
@brettmacdonald8 , Seems like you are creating like a column. For new column try like
Rolling Average Sessions =
AVERAGEX(
FILTER( 'Date Functions',
'Date Functions'[Date] <= earlier('Date Functions'[Date])),
'Date Functions'[Sessions])
For new measure
Rolling Average Sessions =
AVERAGEX(
FILTER( ALLSELECTED('Date Functions'),
'Date Functions'[Date] <= MAX('Date Functions'[Date])),
'Date Functions'[Sessions])
or better to use a separate date table
Rolling Average Sessions =
AVERAGEX(
FILTER( ALLSELECTED('Date Functions'),
'Date Functions'[Date] <= MAX('Date Functions'[Date])),
'Date Functions'[Sessions])
Rolling Average Sessions =
AVERAGEX(
FILTER( ALLSELECTED('Date'),
'Date'[Date] <= MAX('Date'[Date])),
'Date Functions'[Sessions])
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Hi, @brettmacdonald8 , you might want to try this formula in a calculated column
Rolling Average Sessions =
AVERAGEX (
FILTER (
ALL ( 'Date Functions'[Date] ),
'Date Functions'[Date] <= EARLIER ( 'Date Functions'[Date] )
),
'Date Functions'[Sessions]
)
| Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
I'd strongly and kindly suggest you read about ALLSELECTED. You're not using it properly and don't understand what it's for and how it behaves. Here's an article: The definitive guide to ALLSELECTED - SQLBI
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 9 | |
| 6 | |
| 5 |
| User | Count |
|---|---|
| 27 | |
| 22 | |
| 20 | |
| 17 | |
| 12 |