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
DoeJohn
Frequent Visitor

Carried Over Beginning Balance from Previous Period Ending Balance

Hi All!

I have a confusion finding the right way to get carried over beginning cost value from previous period ending cost. I have read about recursion in power BI and I try to avoid it. Please suggest the most efficient way to solve this in power BI!!
I provide the sample data here as well. Please do ask if there's any question! Thanks 😀

Formula:
1. Ending Cost = ((Beginning Cost * Beginning Volume) + (Production Cost * Production Volume)) / (Beginning Volume + Production Volume)
2. Beginning Volume = Prev. month Beginning Volume + Prev. month Production Volume - Prev. month Sales Volume

 

Logic      
MonthBeginning CostBeginning VolumeProduction CostProduction VolumeSales VolumeEnding Cost (Average Cost)
Jan-231003797202398,95
Feb-2398,9534101305099,91
Mar-2399,911493343795,02

 

Input      
MonthBeginning CostBeginning VolumeProduction CostProduction VolumeSales VolumeEnding Cost (Average Cost)
Jan-2310037972023 
Feb-23  1013050 
Mar-23  933437 

 

Expected Output  
MonthBeginning CostEnding Cost (Average Cost)
Jan-23100,00                                       98,95
Feb-2398,95                                       99,91
Mar-2399,91                                       95,02
3 REPLIES 3
onurbmiguel_
Super User
Super User

Hello @DoeJohn 

Can you sahre a pbix with some dummy values so i can look at the model? 

 

 

Best regards

Bruno Costa | Impactful Individual

 

 


Best regards


Bruno Costa | Super User


 


Did I help you to answer your question? Accepted my post as a solution! Appreciate your Kudos!! 


Take a look at the blog: PBI Portugal 


 


DoeJohn
Frequent Visitor

Hi Amitchandak,

Thanks for the reply!

However, while current month beginning cost is prev month ending cost, current month ending cost is dependent on current month beginning cost. Thus, when writing the formula I got circular dependency error since they are dependent on each other...

Thanks,
John

amitchandak
Super User
Super User

@DoeJohn , for the previous month you can use Time Intelligence

 

example

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

 

 

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

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.