Forum Discussion
Moving Average -> Standard Deviation
- 6 years ago
Hi rsbin ,
How about using ALLSELECTED in the expression?
3DayStdDev_EquipIDRatio = VAR CurrentIndex = MAX ( GeneralStatistics[GSIndex] ) VAR PreviousIndex = CurrentIndex - 2 VAR _table = SUMMARIZE ( FILTER ( ALLSELECTED (GeneralStatistics ), ------------------edited GeneralStatistics[TotalVisits] <> 0 && GeneralStatistics[GSIndex] >= PreviousIndex && GeneralStatistics[GSIndex] <= CurrentIndex ), [Date], "_EquipIDRatio", [EquipmentIDRatio] ) RETURN STDEVX.P ( _table, [_EquipIDRatio] )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi rsbin ,
How about this?
3DayStdDev_EquipIDRatio =
VAR CurrentIndex =
MAX ( GeneralStatistics[GSIndex] )
VAR PreviousIndex = CurrentIndex - 2
VAR _table =
SUMMARIZE (
FILTER (
GeneralStatistics,
GeneralStatistics[TotalVisits] <> 0
&& GeneralStatistics[GSIndex] >= PreviousIndex
&& GeneralStatistics[GSIndex] <= CurrentIndex
),
[Date],
"_EquipIDRatio", [EquipmentIDRatio]
)
RETURN
STDEVX.P ( _table, [_EquipIDRatio] )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Good Morning Icey
Thanks much for the reply. I have attempted that code as as Solution, but it returns only an answer for the last date.
The ".03142" is the correct answer for Index = 7. I too thought it would cycle through and provide an answer for each Index, but as you can from the above, it Returns just a single value.
I got up this morning thinking "CALCULATETABLE" might be the way to proceed. Really appreciate you taking the time to respond. If you have further suggestions I would be grateful to hear them. Kudos for the attempt.
Kind Regards,
- Icey6 years agoCommunity Support
Hi rsbin ,
How about using ALLSELECTED in the expression?
3DayStdDev_EquipIDRatio = VAR CurrentIndex = MAX ( GeneralStatistics[GSIndex] ) VAR PreviousIndex = CurrentIndex - 2 VAR _table = SUMMARIZE ( FILTER ( ALLSELECTED (GeneralStatistics ), ------------------edited GeneralStatistics[TotalVisits] <> 0 && GeneralStatistics[GSIndex] >= PreviousIndex && GeneralStatistics[GSIndex] <= CurrentIndex ), [Date], "_EquipIDRatio", [EquipmentIDRatio] ) RETURN STDEVX.P ( _table, [_EquipIDRatio] )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- rsbin6 years agoCommunity Champion
Good Morning Icey
Yes, the edit works. I finally am able to get the Std. Dev values for each Index. Thank you very much for the assistance.
Unfortunately, still having some issues having it display properly in my line charts. I have to figure out why it is behaving like that.
But thanks again, it is a relief to finally solve the first part of this.
Kind Regards and all the best,