Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hola
Tengo a continuación una tabla de muestra donde estoy tratando de calcular la diferencia de ventas por volumen interanual. Probé la siguiente fórmula, sin embargo, resume todos los valores entre 2020 y 2017, no solo el valor de 2020.
2020 = CALCULATE(SUM('P&L'[Valores]), SAMEPERIODLASTYEAR('P&L'[AÑO CALENDARIO]))
2019 = CALCULATE(SUM('P&L'[Valores]), SAMEPERIODLASTYEAR('P&L'[AÑO CALENDARIO],-2,año))
¿Alguien puede tener una solución para este problen?
Año natural | Cliente | P&L | Valores |
2017 | MERCADOS ACME | Volumen de ventas | 300396404 |
2018 | MERCADOS ACME | Volumen de ventas | 323496404 |
2019 | MERCADOS ACME | Volumen de ventas | 457496404 |
2020 | MERCADOS ACME | Volumen de ventas | 789189639 |
2021 | MERCADOS ACME | Volumen de ventas | 679762927 |
Hola
SAMEPERIODLASTYEAR trabaja con fechas idealmente en una tabla de fechas. Sin embargo, ya tiene datos agregados a nivel de año.
Entonces, para obtener los datos para 2020, puede hacer:
2020Vals =
CALCULATE(
SUM('P&L'[Values]),
'P&L'[CALENDAR YEAR] = 2020
)
Para algo un poco más dinámico:
PreviousYearVals =
VAR LatestVisibleYear =
MAX ( 'P&L'[CALENDAR YEAR] )
RETURN
CALCULATE(
SUM('P&L'[Values]),
'P&L'[CALENDAR YEAR] = LatestVisibleYear - 1
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |