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
okusai3000
Helper IV
Helper IV

Average Balance until selected month

Hi everyone,

 

I'm trying to make a finance dashboard, and I need to have the average monthly balance of the year and selected month. 

The idea is that If we have selected June, I need an average of the sum of balances gotten in each month, divided by 6

 

The Measure that creates the Balance is a SUM of all the accounts until the selected month.

 

Here's the balance measure (actually it's a simply running total):

 

 CALCULATE (
    SUM ( 'fact SAP_Libro_Mayor_Lineas'[Cargo_abono] ),
    FILTER (
        ALL ( 'dim Fecha2'[Fecha] ),
        'dim Fecha2'[Fecha] <= MAX ( 'dim Fecha2'[Fecha] ))

 

And this my try to get the avg :

 

 

 

*Activo Medio =
VAR Activo_Mes = calculate([*Saldo Balance],'dim SAP_Cuentas_Contables_Familia'[Descrip_CAT1]="Activo", filter(all('dim Fecha2'[Fecha]),'dim Fecha2'[Fecha] <= MAX ( 'dim Fecha2'[Fecha] )))

RETURN
AVERAGEX(SUMMARIZE('fact SAP_Libro_Mayor_Lineas','dim Fecha2'[Mes],'dim Fecha2'[Año],"Activo_Mes",Activo_Mes),[Activo_Mes])

 

 

Any ideas?

thanks!!

1 ACCEPTED SOLUTION
okusai3000
Helper IV
Helper IV

SOLVED:

Saldo Balance=CALCULATE (
    SUM ( 'fact SAP_Libro_Mayor_Lineas'[Cargo_abono] ),

DATESBETWEEN('dim Fecha2'[Fecha],MINX(ALL('dim Fecha2'),STARTOFYEAR('dim Fecha2'[Fecha])),max('dim Fecha2'[Fecha]))

 

Activo Medio:= 

AVERAGEX(
    SUMMARIZE(
        CALCULATETABLE('dim Fecha2',DATESBETWEEN('dim Fecha2'[Fecha],STARTOFYEAR('dim Fecha2'[Fecha]),ENDOFMONTH('dim Fecha2'[Fecha]))),
        'dim Fecha2'[Año],'dim Fecha2'[Mes],"ABCD",calculate([*Saldo Balance],'dim SAP_Cuentas_Contables_Familia'[Descrip_CAT1]="Activo")),
        [ABCD])

 

 

View solution in original post

2 REPLIES 2
okusai3000
Helper IV
Helper IV

SOLVED:

Saldo Balance=CALCULATE (
    SUM ( 'fact SAP_Libro_Mayor_Lineas'[Cargo_abono] ),

DATESBETWEEN('dim Fecha2'[Fecha],MINX(ALL('dim Fecha2'),STARTOFYEAR('dim Fecha2'[Fecha])),max('dim Fecha2'[Fecha]))

 

Activo Medio:= 

AVERAGEX(
    SUMMARIZE(
        CALCULATETABLE('dim Fecha2',DATESBETWEEN('dim Fecha2'[Fecha],STARTOFYEAR('dim Fecha2'[Fecha]),ENDOFMONTH('dim Fecha2'[Fecha]))),
        'dim Fecha2'[Año],'dim Fecha2'[Mes],"ABCD",calculate([*Saldo Balance],'dim SAP_Cuentas_Contables_Familia'[Descrip_CAT1]="Activo")),
        [ABCD])

 

 

Hi @okusai3000 ,

It's glad to hear that your problem has been resolved. And thanks for sharing your solution here. Could you please mark the helpful post as Answered? It will help the others in the community find the solution easily if they face the same problem as yours.  Thank you.

Best Regards

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

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.