Forum Discussion

MaheshMk's avatar
MaheshMk
Frequent Visitor
7 years ago
Solved

opening balance issue

Hi folks, 

 

I've a challenge with Opening Balance :) It works well for the first couple of rows but doesn't afterwards. Please help. 

 

Sure, I'm missing a trick here. 

 

Thanks, 
Mahesh

  • Hi MaheshMk 

     

    You can use the below pattern.

    previousMonthRR = 
    VAR _lpd = CALCULATE(
        LASTDATE( 'Calendar'[Date] ),
        PARALLELPERIOD( 'Calendar'[Date], -1, MONTH )
    ) 
    RETURN CALCULATE( 
        SUM( Table[Added] ) - SUM( Table[Sold] ) + SUM( Table[Returned] )
        'Calendar'[Date] <= _lpd 
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski

     

2 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi MaheshMk ,

    Have you solved the problem?

    If you have solved, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

    If you still need help, please share your data sample as table format and your desired output so that we could help further on it.

    Best  Regards,

    Cherry

     

  • Mariusz's avatar
    Mariusz
    Icon for Community Champion rankCommunity Champion

    Hi MaheshMk 

     

    You can use the below pattern.

    previousMonthRR = 
    VAR _lpd = CALCULATE(
        LASTDATE( 'Calendar'[Date] ),
        PARALLELPERIOD( 'Calendar'[Date], -1, MONTH )
    ) 
    RETURN CALCULATE( 
        SUM( Table[Added] ) - SUM( Table[Sold] ) + SUM( Table[Returned] )
        'Calendar'[Date] <= _lpd 
    )

     

    Best Regards,
    Mariusz

    If this post helps, then please consider Accepting it as the solution.

    Please feel free to connect with me.
    Mariusz Repczynski