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
MAMENZAL
Frequent Visitor

MEDIA MOVIL

Buenos días soy nueva aquí, y en Power Bi, necesitaría ayuda con una formula que no entiendo lo que me esta pasando.

Tengo que calcular la media móvil acumulada de ingresos por empleado.

Para ello he calculado el total ingresos mes TotalIngresos = sum(INGRESOS[SALDO])

He calculado los ingresos por empleado: IngrEmple = [TotalIngresos]/[Nº Trabajadores a Fecha]

He calculado el acumulado ingresos por empleado: AcumunladoIngresosporEmpleado = CALCULATE([IngrEmple], DATESINPERIOD('DIM_FECHA ALTABAJA'[Fecha],MAX('DIM_FECHA ALTABAJA'[Fecha]),-12, MONTH))

Y me arroja este resultado:

 

MAMENZAL_0-1657196444013.png

 

 

Me voy a Excel a comprobarlo y veo que el resultado no es el mismo.

 

MAMENZAL_1-1657196444015.png

 

 

Muchisimas gracias por ayudarme.

Un saludo

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Hi  @MAMENZAL ,

You can create a table to extract date value and use it as the category of your visual.
Then you can write a measure formula to extract the current date value as a condition to looping table records and get cumulative results. 

measure =
var _select=MAX('Date'[Date])
return
AVERAGEX(
    FILTER(
        SUMMARIZE(ALL('Table'),
        'Table'[Date],'Table'[Staff],
        "Avg value",AVERAGE('Table'[amount])),
        'Table'[Date] >=DATE(YEAR(_select)-1,MONTH(_select),DAY(_select))&&
    'Table'[Date]<=_select&&'Table'[Staff]=MAX('Table'[Staff])),
        [Avg value])

 

Best Regards,

Liu Yang

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

amitchandak
Super User
Super User

@MAMENZAL , For cumulative  try like

CALCULATE([IngrEmple], filter(allselected('DIM_FECHA ALTABAJA') ,'DIM_FECHA ALTABAJA'[Date] = MAX('DIM_FECHA ALTABAJA'[Date])))

MAMENZAL_0-1657260481087.png

Thank you very much, but the truth is that it does not work either.

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.