Fórmula: promedio semanal de los primeros tres trimestres del año.Hola,
Los datos se muestran a diario (lunes a sábado). He convertido la fecha en días de semana, semanas, meses, trimestres, años.
Estoy tratando de obtener el valor semanal promedio para el período de tiempo 01/01/2015 - 3/10/2015. Esto se mostrará el 5/5/2015 y contendrá el mismo valor para el resto del año.
Entonces, en esencia, es un valor promedio semanal para Q1 - Q3.
Creo que puedo hacer esto en una tabulación, sin embargo, estoy buscando una fórmula sobre cómo hacerlo.
Cualquier ayuda sería muy apreciada.
Gracias,
Re: Fórmula - Promedio semanal para los primeros tres trimestres en un añoAbsolutamente lo haré.
Gracias por toda tu ayudaRe: Fórmula - Promedio semanal para los primeros tres trimestres en un añoLe sugiero que tome cada una de las funciones a continuación, las busque en el Índice de Scripting y estudie los ejemplos dados para cada una de ellas.
Ayuda ==> Índice de Scripting
Aquí está mi explicación de la fórmula que te pasé.
// 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;Re: Fórmula - Promedio semanal para los primeros tres trimestres en un añoHola,
Soy nuevo en JMP y su lenguaje. Si no te molesta que te lo pregunte, me rogarías que me explicaras la fórmula que enumeraste.
La fórmula funcionó y produjo lo que necesitaba para producir, pero estoy tratando de entenderlo en inglés.
Una vez más, gracias por su ayuda.
Re: Fórmula - Promedio semanal para los primeros tres trimestres en un añoGracias,
Los resultados fueron ligeramente diferentes de lo que estaba buscando (obtuve el promedio de cada semana frente al promedio de Q1-Q3 de todas las semanas), y luego me di cuenta de que los resultados producidos por la fórmula son en realidad exactamente lo que necesito. Mi pregunta original debería haber sido cambiada.
Aprecio tu ayuda con esto.
Muchas gracias.
Me ahorraste mucho tiempo
Re: Fórmula - Promedio semanal para los primeros tres trimestres en un añoAquí hay un guión que creo que funcionará ... Realmente no lo probé, pero creo que verá el concepto. La única conjetura que hice, fue la semana de trabajo que es el 5 de octubre.
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;
Re: Fórmula - Promedio semanal para los primeros tres trimestres en un añoLo siento, olvidé mencionar que, cuando comience el nuevo año, tendré un valor de 0 hasta el cuarto trimestre y luego repetiré el proceso con nuevos conjuntos de datos para ese año.
Gracias