cancel
Showing results for 
Search instead for 
Did you mean: 
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
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors