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

Power bi previous date if blank

Hi, I have 2 different tables, one date table 'Datum"[Date] and one table showing a quantity 'T_Part[InvQty] on a certain date of a certain partcode 'T_Part[Partcode]', both tables are related by date.  If a date is not shown in table T_Part I want it to look up the last InvQty of that part. In this case 15-12-2021 until 21-12-2021 should display 759.70, 25-12-2021 and further should display 687.28. I have found many topic about this but can't find anything that works for me.

 

  Warehouse dashboard - Power BI Desktop.jpg

 

If someone could help me out it would be great!

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@ddijstelbloem See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column = 
  VAR __Current = [Value]
  VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])

  VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
  __Current - __Previous



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
miTutorials
Super User
Super User

Please see the below detailed tutorial on this. Hope this helps.

 

Fill Last Non Blank Value in a Table in PowerBI using a Measure | MiTutorials  

 

 

Regards

Mohammed Ismail

www.youtube.com/mitutorials

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

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

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.