Forum Discussion

Antonio_Gomez's avatar
Antonio_Gomez
Icon for Resolver I rankResolver I
4 years ago
Solved

Cummulative Sum Starting From Zero Every Year

Hello everyone! 

 

I'm having this issue. In one hand, I have a regular Calendar Table

 

 

And in the other hand, I have a table for sales:

 

 

The relationship between tables is for the Calendar (Calendario Base[Dia]) and for the Sales (Facturacion[fecha])

 

I'm using a slicer for the years that I took from Calendario Base[año] and using this formula to determine the cummulative sum:

 

FacturacionAcumParcial4 =
CALCULATE(
SUM(Facturacion[ImporteBruto]),
FILTER(
ALLEXCEPT(
'Calendario Base','Calendario Base'[Año]),
'Calendario Base'[Dia] <= MAX('Calendario Base'[Dia])
)
)
 
But, the start amount for the year selected is the accumulated of the previous year and does not start in this case from 0.

 

 

 

 

Please, I need some help!!!!!

 

 

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Antonio_Gomez ,

     

    Please try this measure.

     

    FacturacionAcumParcial4 = 
    CALCULATE (
        SUM ( Facturacion[ImporteBruto] )+0,
        FILTER (
            ALL ( 'Calendario Base' ),
            'Calendario Base'[Dia] <= MAX ( 'Calendario Base'[Dia] )
            &&
            'Calendario Base'[año] = SELECTEDVALUE('Calendario Base'[año])
        )
    )

     

    Attached PBIX file for reference.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Antonio_Gomez ,

     

    Please try this measure.

     

    FacturacionAcumParcial4 = 
    CALCULATE (
        SUM ( Facturacion[ImporteBruto] )+0,
        FILTER (
            ALL ( 'Calendario Base' ),
            'Calendario Base'[Dia] <= MAX ( 'Calendario Base'[Dia] )
            &&
            'Calendario Base'[año] = SELECTEDVALUE('Calendario Base'[año])
        )
    )

     

    Attached PBIX file for reference.

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly -- How to provide sample data