公式 - 一年中前三个季度的每周平均值嗨,
数据每天显示(mon-sat)。 我已将日期转换为星期,星期,月,季度,年。
Iam试图获得2015年1月1日 - 2015年10月3日期间的平均每周价值。 这将在2015年10月5日显示,它将包含一年中其余时间的相同值。
所以从本质上讲,它是Q1 - Q3的每周平均值。
我想我可以在制表中做到这一点,但我正在寻找一个如何做到这一点的公式。
任何帮助将不胜感激。
谢谢,
回复:公式 - 一年中第三季度的平均每周绝对会这样做。
谢谢你的帮助回复:公式 - 一年中第三季度的平均每周我建议您使用下面的每个函数,并在脚本索引中查找它们,并研究为每个函数给出的示例
帮助==>脚本索引
这是我对你传给你的公式的解释
// Create a pointer to the data table so it can be referenced in the
// "Get Rows Where" function
dt = Current Data Table();
// The formula is applied to each row of the data table
// setting tYear equal to :Year sets the value of tYear to the
// Year for the current row. This is a little trick that allows
// for the "Get Rows Where" function to have something to compare to
tYear = :Year;
// For the current row, check to see if the current rows value of Date
// falls between January 1st and October 5th for the current year
If( Date MDY( 1, 1, :Year ) >= :date <= Date MDY( 10, 5, :Year ),
// If it is in between those dates then calculate the Mean of
// the column for Value where all the rows where Week is equal
// to the current row's value of week, and where all the rows where
// Year is equal to the current rows value of year
temp = Col Mean( :Value, :Week, :Year )
,
// If the current row's date isn't between the dates above, then
// find all of the rows where Week is equal to week 39, and year is
// equal to the row;'s current year. Then find the mean of those values
temp = Mean( :Value[dt << get rows where( :Week == 39 & tYear == :Year )] )
);
// The value that JMP returns to a formula is the last value exeuted in the formula
// Therefore, by placing the variable "temp" as the last thing seen, the
// calculated value of temp is what the formula value is
temp;回复:公式 - 一年中第三季度的平均每周嗨,
我是Jmp及其语言的新手。如果您不介意我问,您是否愿意引导我完成您列出的公式。
公式起作用并产生了它需要生产的东西,但我试图用英语来理解它。
再一次,谢谢你的帮助
回复:公式 - 一年中第三季度的平均每周谢谢,
结果与我正在寻找的结果略有不同(我从第一季度到第三季度每周平均得到平均值),然后我意识到公式产生的结果实际上正是我所需要的。 我原来的问题应该改变了。
感谢您对此的帮助。
非常感谢你。
你救了我很多时间
回复:公式 - 一年中第三季度的平均每周这是一个我相信会工作的脚本......我真的没有测试它,但我想你会看到这个概念。 我做出的唯一猜测是10月5日的工作周。
dt = Current Data Table();
tYear = :Year;
If( Date MDY( 1, 1, :Year ) >= :date <= Date MDY( 10, 5, :Year ),
temp = Col Mean( :Value, :Week, :Year ),
temp = Mean( :Value[dt << get rows where( :Week == 39 & tYear == :Year )] )
);
temp;
回复:公式 - 一年中第三季度的平均每周对不起,我忘了提到,新的一年开始,我会有价值0,直到第四季度到来,然后将重复这一过程与当年的新数据集。
谢谢