Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi,
I would like to create a measure that is the rolling average of the values from another measure (a percent). I would like the measure to add up those percentages that are between the current record date and those that are within the last six days and average the result. I'm fairly new to Dax, but have spent several hours trying to figure out the synatax when dealing with an average of a measure and not a column. However, every way I try this I run into problems with the % Coverage column being a measure and not a column. I wonder if anyone can point me in the right direction? I have tried something like this and it didn't give me the correct results.
Solved! Go to Solution.
[Average Sales 1] =
var PeriodToAverageOver =
DATESINPERIOD(
// I just hope this table is a
// properly built date table.
// IF not, please read dax.guide/datesinperiod
// and build a table they talk about
// in there.
'qry_Calendar'[Date],
MAX( 'qry_Calendar'[Date] ),
-6,
DAY
)
var Result =
AVERAGEX(
PeriodToAverageOver,
// I hope the below is a
// measure. It can't be
// a column in a table.
[Coverage Sales%]
)
return
Result
// Now, go to https://www.sqlbi.com/articles/rules-for-dax-code-formatting/
// and follow the rules RELIGIOUSLY. You'll
// thank me later 🙂
[Average Sales 1] =
var PeriodToAverageOver =
DATESINPERIOD(
// I just hope this table is a
// properly built date table.
// IF not, please read dax.guide/datesinperiod
// and build a table they talk about
// in there.
'qry_Calendar'[Date],
MAX( 'qry_Calendar'[Date] ),
-6,
DAY
)
var Result =
AVERAGEX(
PeriodToAverageOver,
// I hope the below is a
// measure. It can't be
// a column in a table.
[Coverage Sales%]
)
return
Result
// Now, go to https://www.sqlbi.com/articles/rules-for-dax-code-formatting/
// and follow the rules RELIGIOUSLY. You'll
// thank me later 🙂
I just wanted to thank you for that solution. I really have been struggling all day on it and I appreciate that you would take the time to answer....and yes, I'm will investigate the proper format for following dax code formatting "religiously" going forward.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
14 | |
9 | |
7 | |
7 | |
6 |
User | Count |
---|---|
22 | |
11 | |
10 | |
10 | |
8 |