Forum Discussion

OscarSuarez10's avatar
OscarSuarez10
Icon for Helper III rankHelper III
7 years ago
Solved

CUMMULATIVE PRODUCTION PER PRODUCT

Hello, I need to calculate the cummultive production of some proudts by periods like in the following table, can you help me? 

 

YearProductProductionCummulative Production
1A  
1A  
1A  
1A  
1A1010
2A  
2A  
2A2030
3A  
3A  
3A  
3A3060
1B  
1B  
1B  
1B  
1B1515
2B  
2B  
2B1025
3B  
3B  
3B  
3B530
  • OscarSuarez10 

     

    You may use DAX below to add a calculated column.

    Column =
    IF (
        NOT ( ISBLANK ( 'Table'[Production] ) ),
        SUMX (
            FILTER (
                'Table',
                'Table'[Product] = EARLIER ( 'Table'[Product] )
                    && 'Table'[Year] <= EARLIER ( 'Table'[Year] )
            ),
            'Table'[Production]
        )
    )
    

     

2 Replies

  • OscarSuarez10 use this DAX to get cummulative, change table and column name as per your model.

     

    Cumm = 
    CALCULATE( 
    SUM( Cumm[Production] ), 
    FILTER( ALLEXCEPT( Cumm, Cumm[Product] ), 
    Cumm[Year] <= MAX( Cumm[Year] )
     )
     )
  • v-chuncz-msft's avatar
    v-chuncz-msft
    Icon for Community Support rankCommunity Support

    OscarSuarez10 

     

    You may use DAX below to add a calculated column.

    Column =
    IF (
        NOT ( ISBLANK ( 'Table'[Production] ) ),
        SUMX (
            FILTER (
                'Table',
                'Table'[Product] = EARLIER ( 'Table'[Product] )
                    && 'Table'[Year] <= EARLIER ( 'Table'[Year] )
            ),
            'Table'[Production]
        )
    )