Forum Discussion
help in rolling average time intelligence
Many thanks.. BUt that code provide me with the exact figure of [RendimientoEhterum] and only in the first day the figure is blank()
I see your concern, and it seems like you want the rolling average to start at zero on the first day of the year. To achieve this, you can slightly modify the RollingAvgPerformance measure to make sure the first day of the year shows 0 performance:
RollingAvgPerformance =
VAR CurrentDate = MAX ( Calendario[Date] )
VAR StartOfYear = DATE ( YEAR ( CurrentDate ), 1, 1 )
RETURN
IF (
[Cot_Ethereum] > 0,
IF (
CurrentDate = StartOfYear,
0, -- Set performance to 0 on the first day of the year
CALCULATE (
AVERAGEX ( VALUES ( Calendario[Date] ), [RendimientoEtherum] - 1 ),
FILTER (
ALLSELECTED ( Calendario ),
Calendario[Date] >= StartOfYear
&& Calendario[Date] <= CurrentDate
)
)
),
BLANK ()
)
In this modified measure:
If [Cot_Ethereum] is greater than 0, it first checks if CurrentDate is equal to the StartOfYear (the first day of the year). If it is, it returns 0 for performance on that day.
For all other days in the year, it calculates the rolling average as before.
This modification ensures that on the first day of the year, the performance is set to 0 while maintaining the rolling average behavior for subsequent days within the year.
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.
In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.