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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
CEllinger
Helper I
Helper I

How To Change or Replace Date Context of Measure

This is what my data table looks like. 

DateQty On HandQty ExpiredQty SoldQty Available
Mar 20211000200300500
Apr 2021 300200 
May 2021 150400 

 

Qty On Hand is from an Inventory Table.

 

Qty On Hand = Calculate(SUM(Inventory), Date=Mar 2021)

 

Qty Expired and Qty Sold numerical values. Qty Available is calculated as:

 

QTY Available = Calculate([Qty On Hand]-([Qty Expired] + [Qty Sold]))

 

How do I remove the Date Context from the Qty on Hand measure so that I can use it in the QTY Available calculation for the future months?

1 REPLY 1
amitchandak
Super User
Super User

@CEllinger , You have to try like

 

QTY Available = Calculate([Qty On Hand], all(Table[Date])) -calculate([Qty Expired] + [Qty Sold]))

 

I think better would be like this with date table

Qty On Hand = Calculate([Qty On Hand], all(Date[Date])) + CALCULATE(SUM(Table[Qty Sold]),filter(date,date[date] <=maxx(date,date[date]))) - CALCULATE(SUM(Table[Qty Expired]),filter(date,date[date] <=maxx(date,date[date])))

 

 

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.

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

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric 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.

Users online (27)