Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jefe_03
New Member

Suma Acumulada Mes a Mes

Estimados Buenas noches,

Tengo una duda quisiera saber que dax podria utilizar para realizar la suma mes a mes de los siguientes datos,

en excel seria de esta forma.

Jefe_03_0-1632195574054.png

Jefe_03_0-1632195623086.png

 

La suma seria para el mes de enero del mes actual, el primer dia de febrero del año anterior hasta el ultimo dia de enero del mes actual.

Podria calcularlo con una medida que genere la suma colocando los limites con el dax fechas entre las fechas a mano, pero quisiera que se genere una tabla con esta información ya que se debe de ir alimentando mes a mes automáticamente.

Intente de esta manera pero no logre el resultado que queria.

 

 

Agredeceria mucho que me ayuden con alguna respuesta.

@Greg_Deckler 

1 ACCEPTED SOLUTION
VahidDM
Super User
Super User

Edited

Hi @Jefe_03 

 

Try this code to add a new column to your table:

 

Acum 2021 = 
VAR _Date = 'Table'[Anio_Mes]
VAR _LDate =
    DATE ( YEAR ( _Date ) - 1, MONTH ( _Date ) + 1, DAY ( _Date ) )
VAR _Year =
    YEAR ( 'Table'[Anio_Mes] )
VAR _Acum =
    CALCULATE (
        SUM ( 'Table'[_Total] ),
        FILTER ( 'Table', 'Table'[Anio_Mes] <= _Date && 'Table'[Anio_Mes] >= _LDate )
    )
RETURN
    IF ( _Year > 2020, _Acum, BLANK () )

 

 

Output:

VahidDM_0-1632198574833.png

 

 

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

Appreciate your Kudos🙏!!

View solution in original post

2 REPLIES 2
Jefe_03
New Member

Thank you!!😁

VahidDM
Super User
Super User

Edited

Hi @Jefe_03 

 

Try this code to add a new column to your table:

 

Acum 2021 = 
VAR _Date = 'Table'[Anio_Mes]
VAR _LDate =
    DATE ( YEAR ( _Date ) - 1, MONTH ( _Date ) + 1, DAY ( _Date ) )
VAR _Year =
    YEAR ( 'Table'[Anio_Mes] )
VAR _Acum =
    CALCULATE (
        SUM ( 'Table'[_Total] ),
        FILTER ( 'Table', 'Table'[Anio_Mes] <= _Date && 'Table'[Anio_Mes] >= _LDate )
    )
RETURN
    IF ( _Year > 2020, _Acum, BLANK () )

 

 

Output:

VahidDM_0-1632198574833.png

 

 

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

Appreciate your Kudos🙏!!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.