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.
Hola a todos,
Estoy teniendo algunos problemas para conseguir un promedio de 3 meses para que funcione correctamente. He probado 5 fórmulas diferentes y devuelven 0 o en blanco. Tengo una tabla de fechas con la primera fecha como 01/01/1989 y una fecha de finalización del 31/12/2027. Mi tabla de datos tiene fechas EndOfMonth, que comienzan el 31/01/2019 y terminan con el 31/08/2022. Sumé los datos a un total mensual en SQL, para ahorrar tiempo al cargar todas las filas.
Aquí hay un ejemplo de la última fórmula que traté de usar:
Cualquier ayuda sería muy apreciada.
¿Has probado este patrón?
https://www.daxpatterns.com/standard-time-related-calculations/#code61
Sales AVG 3M :=
VAR Period3M =
CALCULATETABLE (
DATESINPERIOD (
'Date'[Date],
MAX ( 'Date'[Date] ),
-3,
MONTH
),
'Date'[DateWithSales] = TRUE
)
VAR FirstDayWithData =
CALCULATE (
MIN ( Sales[Order Date] ),
REMOVEFILTERS ()
)
VAR FirstDayInPeriod =
MINX ( Period3M, 'Date'[Date] )
VAR Result =
IF (
FirstDayWithData <= FirstDayInPeriod,
AVERAGEX (
Period3M,
[Sales Amount]
)
)
RETURN
Result
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |