Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi community,
im new to PBI, and been trying to create an Inital/Close balance, but havent been able so far, here is a little example PBIX
the basic are:
This is the result I want
But this is what i get
My model
Inventory = CALCULATE( SUM('Table'[Qty]), 'Table'[Category] = "inv", ALLEXCEPT(Dates, Dates[Date] ))
Sale = CALCULATE( SUM('Table'[Qty] ), 'Table'[Category] ="sale")
Initial balance =
var thisdate = MAX(Dates[Date] )
var vsales =
CALCULATE(
[Sale],
REMOVEFILTERS(Dates ),
'Table'[Date] < thisdate )
RETURN [Inventory] -vsales
Final balance =
var thisdate = MAX(Dates[Date] )
var vsales =
CALCULATE(
[Sale],
REMOVEFILTERS( Dates[Date] ),
'Table'[Date] <= thisdate )
RETURN [Inventory]- vsales
Solved! Go to Solution.
Hi @MichelleLash if sale is outflow (it should be for balance logic) simply create new calculated column with if statement like on picture below and create simple measure of SUM for that new column.
SUM of column should give you balance, so slice and filter as you wish.
Proud to be a Super User!
Hi @MichelleLash if sale is outflow (it should be for balance logic) simply create new calculated column with if statement like on picture below and create simple measure of SUM for that new column.
SUM of column should give you balance, so slice and filter as you wish.
Proud to be a Super User!
I made changes to [Initial Balance] and [_MyFinBal] (my Final Balance).
Initial balance =
VAR thisdate = MAX( 'Table'[Date] )
VAR vsales =
CALCULATE(
[Inventory] + [Arrive] - [Sale],
REMOVEFILTERS( 'Table'[Date] ),
'Table'[Date] < thisdate
)
RETURN
vsales
_MyFinBal = [Initial balance] + [Inventory] + [Arrive] - [Sale]
I didn't change any other measures.
Let me know if you have any questions. I hope this helps.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
68 | |
60 | |
51 | |
36 | |
36 |
User | Count |
---|---|
84 | |
72 | |
58 | |
45 | |
44 |