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
Anonymous
Not applicable

CALCULAR LOS ÚLTIMOS 3 MESES EN COMPARACIÓN CON SU PERÍODO ANTERIOR - DINÁMICO

¡Hola expertos!

¿Alguien podría ayudarme la fórmula para esto?

Estoy tratando de obtener la suma de las ventas de los últimos 3 meses y compararla con los 3 meses anteriores
(así sería como SUM de abril, mayo y junio contra enero, febrero y marzo)
La cosa es que quiero que se configure de una manera dinámica, por lo que siempre obtiene los últimos meses cuando insumo nuevos datos mensuales a lo largo del tiempo!

¡Gracias por la ayuda! 😉

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hola

Suponiendo que la tabla Sales se actualice solo una vez al mes y que tenga una tabla Calendar que se expande a medida que la tabla Sales obtiene filas adicionales cada mes, pruebe estas medidas

Total sales = SUM(Data[Sales])
Sales for 3 months ended the current month = calculate([Total sales],datesbetween(calendar[date],edate(eomonth(max(calendar[date]),-1)+1,-2),max(calendar[date])))
Sales for previous 3 months = calculate([Total sales],datesbetween(calendar[date],edate(eomonth(max(calendar[date]),-1)+0,-5),edate(eomonth(max(calendar[date]),-3)))

En la segmentación de datos, seleccione cualquier 1 mes y 1 año (ambos en la tabla Calendario).

Si esto no ayuda, entonces comparte el enlace desde donde puedo descargar tu archivo PBI.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@yohandipt , Pruebe con un calendario de fechas.

Ejemplo

Rolling 3 á CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,MONTH))
Rolling 3 á CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-3,MONTH))
Rolling 3 hasta el último 3 meses - CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],-3,month)),-3,MONTH))

Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...


Apreciamos tus Felicitaciones.

Anonymous
Not applicable

@amitchandak ¡Perfecto! ¡Funcionó! Gracias por la ayuda 😉

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.