Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
I am trying to get a rolling 7 day average of a value field. I seem to be having some issues and need some suggestions. Thanks for any input.
Current Output:
Current Measures:
Load to Store Avg =
AVERAGEX('Load to Store','Load to Store'[value])
Rolling Load to Store Avg =
AVERAGEX(
FILTER(ALLSELECTED(Dates[Date]),
Dates[Date] <= MAX(Dates[Date])),
[Load to Store Avg]
)
7 Day Avg =
VAR period = 7
VAR the_first_date =
CALCULATE ( FIRSTDATE ( Dates[Date] ), ALLSELECTED ( Dates[Date] ) )
VAR last_date =
LASTDATE ( Dates[Date] )
VAR sum_in_period =
CALCULATE (
[Rolling Load to Store Avg],
DATESINPERIOD ( Dates[Date], last_date, - period, DAY )
)
RETURN
IF ( last_date - the_first_date >= period - 1, sum_in_period )
7 Day Avg V2 =
CALCULATE (
[Rolling Load to Store Avg] / 7,
DATESINPERIOD (
Dates[Date],
LASTDATE ( Dates[Date] ),
-7,
DAY
),
FILTER (
ALL (Dates[Date] ),
MAX ( Dates[Date] ) < TODAY ()
)
)
Solved! Go to Solution.
@Powerline56 , Make sure year, month, and day are coming from date table(in visual) and date table is marked as date table
Try with small change
@Powerline56 , Try like assume you have measure Rolling Load to Store Avg or the sum measure Rolling Load to Store
Try a new measure like
CALCULATE (
AvergaeX(values(Dates[Date]) , [Rolling Load to Store Avg] ) ,
DATESINPERIOD (
Dates[Date],
LASTDATE ( Dates[Date] ),
-7,
DAY
),
FILTER (Dates, Dates[Date] < TODAY ())
)
Thanks for the quick reply. I have created a new measure(7 Day Avg V3) with your dax recommendations. It seems to be mirroring the "Load to Store Avg" calc. Any suggestions?
@Powerline56 , Make sure year, month, and day are coming from date table(in visual) and date table is marked as date table
Try with small change
Great that seems to fix the issue. I will select this as the solution. I have one more questions regarding this calc. I am needing to create a seperate measure that will populate based on you're supplied measure calc. I'm hoping you can help out with how to add a measure as filter context to a seperate measure? Below is the "ask".
Process Orders 7 Day Avg =
CALCULATE (
AVERAGEX (
VALUES ( 'Process Orders'[Inspection Point Date] ),
[Rolling Process Orders Avg]
),
DATESINPERIOD (
'Process Orders'[Inspection Point Date],
LASTDATE ( 'Process Orders'[Inspection Point Date] ),
-7,
DAY
),
'Process Orders'[Inspection Point Date]
< TODAY ()
)
I am needing to create a calculation that using the structure of the below filter context. The calc below with work without errors but is the filter context used correctly with this method? Thanks!
New_Calc =
Switch(
True(), [Process Orders 7 Day Avg] > 1, 1,
[Process Orders 7 Day Avg] >0,5,
0
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
116 | |
82 | |
47 | |
42 | |
31 |
User | Count |
---|---|
186 | |
80 | |
72 | |
48 | |
45 |