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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Instrucciones paso a paso para obtener un promedio móvil de 12 meses

¡Hola comunidad bi poder!

Es el novato de nuevo 🙂 necesito ayuda para agregar un promedio móvil de 12 meses a mis imágenes. Se adjunta una captura de pantalla de fechas en mi fecha y el importe de ventas. El mes calendario y el año se creó en Power bi, Sales Amt estaba en el archivo cuando lo importé. He visto varios videos, pero no puedo conseguirlo. He intentado Medida rápida, pero no me permitirá seleccionar un campo para la opción 'Fecha'. Cualquier ayuda es muy apreciada! ¡Muchas gracias! Stephanie

Dates & sales.JPG

3 REPLIES 3

Hola @SSPBI23 ,

echa un vistazo aquí.

https://www.sqlbi.com/articles/rolling-12-months-average-in-dax/

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

Hola @mwegener,

Gracias por tender la mano. Sigo obteniendo un error en la parte del calendario porque no tengo una tabla de calendario, así que supongo que primero necesito averiguar cómo hacerlo.

hola @SSPBI23

Puño, será mejor que tenga una tabla de calendario tenue en su modelo de datos, vea este blog para obtener más detalles:

https://radacad.com/do-you-need-a-date-dimension

En segundo lugar, para su caso, la forma más fácil de hacerlo es Medida rápida, pero hacer algún ajuste en él como se muestra a continuación:

El primero funcionará en la jerarquía de fechas integrada

Sales rolling average = 

 VAR __LAST_DATE = ENDOFMONTH('Calendar'[Date].[Date])
 VAR __DATE_PERIOD =
  DATESBETWEEN(
   'Calendar'[Date].[Date],
   STARTOFMONTH(DATEADD(__LAST_DATE, -3, MONTH)),
   __LAST_DATE
  )
 RETURN
  AVERAGEX(
   CALCULATETABLE(
    SUMMARIZE(
     VALUES('Calendar'),
     'Calendar'[Date].[Year],
     'Calendar'[Date].[QuarterNo],
     'Calendar'[Date].[Quarter],
     'Calendar'[Date].[MonthNo],
     'Calendar'[Date].[Month]
    ),
    __DATE_PERIOD
   ),
   CALCULATE(SUM('Table'[Sales]), ALL('Calendar'[Date].[Day]))
  )

o esto funcionará en la jerarquía de fechas personalizada

Sales rolling average 2 = 

 VAR __LAST_DATE = ENDOFMONTH('Calendar'[Date])
 VAR __DATE_PERIOD =
  DATESBETWEEN(
   'Calendar'[Date],
   STARTOFMONTH(DATEADD(__LAST_DATE, -3, MONTH)),
   __LAST_DATE
  )
 RETURN
  AVERAGEX(
   CALCULATETABLE(
    SUMMARIZE(
     VALUES('Calendar'),
     'Calendar'[Calendar month and year]
    ),
    __DATE_PERIOD
   ),
   CALCULATE(SUM('Table'[Sales]), ALL('Calendar'[Date]))
  )

aquí está mi simple archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors