Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Rolling stock

Hello, i need to calculate the rolling stock for this:

 

 

the stock before Oct/2019 is =6314 

the stock of october need to be =6314+ ENTRATE(october) - CHIUSE(october)

november= october stock +ENTRATE(november) - CHIUSE(november)

how can i do it? thank you very much 

 

  • Anonymous's avatar
    Anonymous
    6 years ago

    Hello @Mcarotenuto89 ,

    You can create a measure as follows:

    Result =
    VAR _ent =
        SUMX (
            FILTER (
                ALLSELECTED ( 'Test' ),
                'Test'[Date] <= MAX ( 'Date'[Mese-Anno] )
                    && 'Test'[Date] >= DATE ( 2019, 10, 1 )
            ),
            [ENTRATE]
        )
    VAR _chiu =
        SUMX (
            FILTER (
                ALLSELECTED ( 'Test' ),
                'Test'[Date] <= MAX ( 'Date'[Mese-Anno] )
                    && 'Test'[Date] >= DATE ( 2019, 10, 1 )
            ),
            [CHIUSE]
        )
    RETURN
        IF (
            MAX ( 'Date'[Mese-Anno] ) < DATE ( 2019, 10, 1 ),
            6314,
            6314 + ( _ent - _chiu )
        )

    Rolling stock.JPG

    Best regards

    Rena

7 Replies