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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vwiles84
Helper III
Helper III

Use first date in date slicer for measure calc

Hello. I am trying to create an inventory consumption report that shows beginning inventory total, consume/adjusted amount and ending inventory amount. I have the ending inventory measure and the consumed/adjusted measure working but i am not quite getting the beginning amount. I have a date sliced added to the report so what i need to figure out is how to write the beginning inventory measure that sums the inventory up to the first date in the date slicer.  What is the best way to write the DAX? 

I have tried this: but it gives me (blank) or the ending balance, not beginning:

Beginning Balance =
var LastInventoryDate = CALCULATE(LASTDATE('TABLE'[Posting Date]), ALL('TABLE$Item Ledger Entry'))
return
IF(SELECTEDVALUE('Date'[Date]) > LastInventoryDate, BLANK(),
CALCULATE(SUM('TABLE$Item Ledger Entry'[Quantity]), FILTER(ALLSELECTED('Date'), 'Date'[Date] <= MAX('Date'[Date])))) 
 
I have also tried this: 
Beginning Balance = CALCULATE(SUM('TABLE$Item Ledger Entry'[Quantity]), FILTER(ALL('Date'[Date]), 'Date'[Date] >= MAX('Date'[Date])))
 
but it does not work. 
Any help would be greatly appreciated. 
2 REPLIES 2
amitchandak
Super User
Super User

@vwiles84 ,Can you share sample data and sample output.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I actually got the calculation to work with this: 

CALCULATE(SUM('TABLE'[Quantity]), FILTER(ALL('Date'), 'Date'[Date] < MINX('Date', 'Date'[Date])))

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors