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
tracytran91
Helper III
Helper III

Obtener el valor del mes anterior del año anterior

Hola amigos,

Me gustaría obtener el valor de venta del mes anterior del año pasado.

Por ejemplo:

En enero de 2021, deseo obtener el valor en diciembre de 2019.

En febrero de 2021, deseo obtener el valor en enero de 2020.

En marzo de 2021, deseo obtener el valor en febrero de 2020.

....

Cualquier entrada es muy apreciada. Gracias de antemano!

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@tracytran91 , Con tabla de fechas e inteligencia de tiempo

Trate de ejemplo

Ventas MTD: CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
Last year MTD Sales ? CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-13,MONTH)))

13 meses detrás de Ventas - CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-13,Month))

Power BI — Mes a mes con o sin inteligencia de tiempo
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

View solution in original post

3 REPLIES 3
tracytran91
Helper III
Helper III

Gracias @amitchandak @CNENFRNL funciona perfectamente!!!

amitchandak
Super User
Super User

@tracytran91 , Con tabla de fechas e inteligencia de tiempo

Trate de ejemplo

Ventas MTD: CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
Last year MTD Sales ? CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-13,MONTH)))

13 meses detrás de Ventas - CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-13,Month))

Power BI — Mes a mes con o sin inteligencia de tiempo
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA

CNENFRNL
Community Champion
Community Champion

@tracytran91 , puede usar una tabla de fechas estándar en el modelo de datos y, a continuación, aprovechar DATEADD(Calendar[Date], -13, Month) para recuperar el mes deseado.


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

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.