在 Spotfire 中查找前 3 个月的平均值
Find the previous 3 month average value in Spotfire
我正在尝试获取过去 3 个月的平均值。到目前为止找不到适合我要求的样品。感谢您提供的任何帮助。
我需要考虑多个列。我必须在计算中加上当月的 good% 和 out% 才能得到预测。
此代码出错,列中反映的值不正确。
Sum([out]) / Sum([in]) 在 (LastPeriods(3,[month]))
Dt TotalIN TotalOut Good OUT% Good%
2/1/2019 79606 51384 0 64.55% 0
3/1/2019 84194 61211 0 72.70% 0
4/1/2019 92458 67807 0 73.34% 0
5/1/2019 94531 66988 95 70.86% 0.10%
6/1/2019 29623 18181 2903 60.94% 9.73%
感谢您添加一些我可以复制的数据。以下是我制作的摘要专栏的清晨黑客table。我还将行轴装箱以完成这项工作。
列计算:
(Sum([Good%]) * ((
Sum([TotalOut]) OVER (Previous([Axis.Rows],3)) + Sum([TotalOut]) OVER (Previous([Axis.Rows],2)) + Sum([TotalOut]) OVER (Previous([Axis.Rows],1)))
/ (
Sum([TotalIn]) OVER (Previous([Axis.Rows],3)) + Sum([TotalIn]) OVER (Previous([Axis.Rows],2)) + Sum([TotalIn]) OVER (Previous([Axis.Rows],1)))))
+ Sum([Out%])
行轴:
<BinByDateTime([Dt],"Year.Month",1)>
下面可能有一个更简洁的版本,但我不喜欢 THEN
。 LastPeriods
的问题是,如果没有足够的月份,您需要 NULL
。
THEN If(Count() OVER (LastPeriods(3,[Axis.X]))=3,[Value],NULL)
我正在尝试获取过去 3 个月的平均值。到目前为止找不到适合我要求的样品。感谢您提供的任何帮助。
我需要考虑多个列。我必须在计算中加上当月的 good% 和 out% 才能得到预测。
此代码出错,列中反映的值不正确。 Sum([out]) / Sum([in]) 在 (LastPeriods(3,[month]))
Dt TotalIN TotalOut Good OUT% Good%
2/1/2019 79606 51384 0 64.55% 0
3/1/2019 84194 61211 0 72.70% 0
4/1/2019 92458 67807 0 73.34% 0
5/1/2019 94531 66988 95 70.86% 0.10%
6/1/2019 29623 18181 2903 60.94% 9.73%
感谢您添加一些我可以复制的数据。以下是我制作的摘要专栏的清晨黑客table。我还将行轴装箱以完成这项工作。
列计算:
(Sum([Good%]) * ((
Sum([TotalOut]) OVER (Previous([Axis.Rows],3)) + Sum([TotalOut]) OVER (Previous([Axis.Rows],2)) + Sum([TotalOut]) OVER (Previous([Axis.Rows],1)))
/ (
Sum([TotalIn]) OVER (Previous([Axis.Rows],3)) + Sum([TotalIn]) OVER (Previous([Axis.Rows],2)) + Sum([TotalIn]) OVER (Previous([Axis.Rows],1)))))
+ Sum([Out%])
行轴:
<BinByDateTime([Dt],"Year.Month",1)>
下面可能有一个更简洁的版本,但我不喜欢 THEN
。 LastPeriods
的问题是,如果没有足够的月份,您需要 NULL
。
THEN If(Count() OVER (LastPeriods(3,[Axis.X]))=3,[Value],NULL)