Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Syndicate_Admin
Administrator
Administrator

Medida del año anterior

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 naturalClienteP&LValores
2017MERCADOS ACMEVolumen de ventas300396404
2018MERCADOS ACMEVolumen de ventas323496404
2019MERCADOS ACMEVolumen de ventas457496404
2020MERCADOS ACMEVolumen de ventas789189639
2021MERCADOS ACMEVolumen de ventas679762927
1 REPLY 1
Syndicate_Admin
Administrator
Administrator

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
	)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.