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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MaheshMk
Frequent Visitor

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

PBI OPBAL Issue.png

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community 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

 

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident 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

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Mariusz
Community Champion
Community 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

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.