Anónimo
Estoy tratando de crear un cálculo dinámico del índice de precios al consumidor (CPI) que establece el año base en función de mi cortadora de fechas.
El índice se calcula mediante el siguiente principio:
(Año 2 de $ 250 000 / Año base de $ 150 000) * 100 = 167
Mi tabla de entrada se ve así:
Year Consumer Price Index 1980 1980 100 1981 110 1982 120 1983 130 1984 140 1985 130 1986 140 1987 150 1988 160 1989 170 1990 180 1991 190 1992 200 1993 230 1994 240 1995 250 1996 260 1997 270 1998 280
He logrado crear una medida que establece estáticamente el año base en 1990, sin embargo, esto, por supuesto, no responde a mi cortador de fecha.
Consumer Price Index 1990 = DIVIDE( CALCULATE(SUM(tblCPI[Consumer Price Index 1980])); CALCULATE(SUM(tblCPI[Consumer Price Index 1980]);FILTER(ALL(tblCPI);tblCPI[Year] = 1990)) ) * 100
Sin embargo, fallo cuando intento establecer el año base dinámicamente con MIN en lugar de 1990.
Consumer Price Index Dynamic = DIVIDE( CALCULATE(SUM(tblCPI[Consumer Price Index 1980])); CALCULATE(SUM(tblCPI[Consumer Price Index 1980]);FILTER(ALL(tblCPI);tblCPI[Year] = MIN(tblCPI[Year])) ) * 100)
¡Cualquier ayuda será muy apreciada!
v-piga-msft
Hola @Anónimo,
Pruebe la fórmula siguiente.
Consumer Price Index Dynamic = VAR yearbase = CALCULATE ( MIN ( 'tblCPI'[Year] ), ALLSELECTED ( tblCPI ) ) RETURN DIVIDE ( CALCULATE ( SUM ( tblCPI[Consumer Price Index 1980] ) ), CALCULATE ( SUM ( tblCPI[Consumer Price Index 1980] ), FILTER ( ALL ( tblCPI ), tblCPI[Year] = yearbase ) ) ) * 100
Atentamente,
cereza
v-piga-msft
Hola @Anónimo,
Pruebe la fórmula siguiente.
Consumer Price Index Dynamic = VAR yearbase = CALCULATE ( MIN ( 'tblCPI'[Year] ), ALLSELECTED ( tblCPI ) ) RETURN DIVIDE ( CALCULATE ( SUM ( tblCPI[Consumer Price Index 1980] ) ), CALCULATE ( SUM ( tblCPI[Consumer Price Index 1980] ), FILTER ( ALL ( tblCPI ), tblCPI[Year] = yearbase ) ) ) * 100
Atentamente,
cereza
Vvelarde
@Anónimo
Hola, intentemos con esto:
Consumer Price Index Dynamic = VAR YearBase = SELECTEDVALUE ( tblCPI[Year] ) RETURN DIVIDE ( CALCULATE ( SUM ( tblCPI[Consumer Price Index 1980] ) ); CALCULATE ( SUM ( tblCPI[Consumer Price Index 1980] ); FILTER ( ALL ( tblCPI ); tblCPI[Year] = YearBase ) ) * 100 )
Saludos
siddhartha0208
En respuesta a Vvelarde
Hola, esta es una gran solución. Tengo un problema un poco complejo con el campo de país agregado y necesito calcular esto para cada país, ¿alguna orientación?
por ejemplo, mis datos se parecen a lo siguiente:
Que se puede representar en formato pivotado como:
Ahora el usuario selecciona el año 2016 y necesito calcular el CPI en función de los valores de 2016 para generar de la siguiente manera:
¿Alguna orientación?