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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
SarahVenk
Regular Visitor

Projected inventory based on previous Physical inventory OR Projection

Hi!! I'm going crazy trying to calculate the Projected column in Power BI as per the formula below -

SarahVenk_1-1666210435294.png

All I need is - for a combination of warehouse and item,
if the value Phy in the previous month is <>0, Projected = Previous month Phy+previous month Backlog
If the value Phy in the previous month is= 0, Projected = Previous month's Projected+previous month Backlog

Appreciate your help!!



 

2 REPLIES 2
SarahVenk
Regular Visitor

Thanks for your response! Is there any way to achieve this in Power Query? Any workarounds?

 

Greg_Deckler
Super User
Super User

@SarahVenk Well, the first part is below but your second part delves into recursion and thus misery and can't be done in DAX:

Project Column = 
  VAR __Item = [Item]
  VAR __WH = [Warehouse]
  VAR __LMEnd = EOMONTH([Date],-1)
  VAR __LM = DATE(YEAR(__LMEnd),MONTH(__LMEnd),1)
  VAR __Table = FILTER('Table',[Warehouse] = __WH && [Item] = __Item && [Date] = __LM)
  VAR __LMPhy = MAXX(FILTER(__Table,[Phy])
  VAR __LMBacklog = MAXX(FILTER(__Table,[Backlog])
RETURN
  IF(__LMPhy <> 0,__LMPhy + __LMBacklog, BLANK())

 



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors