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

Cómo crear una media móvil a partir de una medida

Tengo una medida: 'Las ventas mensuales cuentan'

Esta medida se calcula a partir de la tabla 'Ventas mensuales' que tiene una tabla establecida con 'MiFecha'.

La tabla 'MiFecha' tiene una columna Mes para recuperar el nombre del mes de la fecha.

Columnas en la tabla 'MyDate': 'SalesDate' en formato mm/dd/aa, y 'Mes' con el nombre de los meses.

Aquí está el DAX que se me ocurrió para calular 2 meses de promedio móvil:

AR =
DÓNDE CurrentDate = LASTDATE('MiFecha'[SalesDate])
DÓNDE ThreeMonthsAgo = EDATE(CurrentDate, -3)
DEVOLUCIÓN
PROMEDIOX(
FILTRO(
'MiFecha',
'MyDate'[SalesDate] >= ThreeMonthsAgo && 'MyDate'[SalesDate] <= CurrentDate
),
CALCULAR([Recuento mensual de ventas])
)

Aquí está el resultado que obtengo:

daxN_0-1686244567577.png

¿Cómo obtengo el promedio móvil para cada mes?

¡Gracias!

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Resuelto: CALCULATE([Measure],DATESINPERIOD( 'Date'[Date], MIN( 'Date'[Date] ) -1, -3, MONTH ))

View solution in original post

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

Resuelto: CALCULATE([Measure],DATESINPERIOD( 'Date'[Date], MIN( 'Date'[Date] ) -1, -3, MONTH ))

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.