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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
goyalsa
Helper III
Helper III

Running calculation bug

Hi all,

 

I am struggling to figure this out. Would really appreciate your help.

goyalsa_0-1647596017469.png

 

Scenario:

In the Stock overview matrix, I have total supply and total demand. The Gross Inventory = Total Supply - Total Demand and then the gross inventory for 202211 will be starting stock for 202212.

 

Gross Inventory Measure = 

Gross Inventory = CALCULATE([Total Supply]-[Total Demand], FILTER(ALLSELECTED(Dates),Dates[Loadingweek] <= MAX(Dates[Loadingweek])))

 

But the problem is sometimes I get the total demand -ve and at that time I do not want to include that total demand in the calculation. Then I want to take Forecasted demand from the Demand Matrix. 

 

Thank you in advance!!

2 REPLIES 2
amitchandak
Super User
Super User

@goyalsa ,

Gross Inventory Measure =
Gross Inventory = CALCULATE([Total Supply]-if([Total Demand]>0,[Total Demand],0) , FILTER(ALLSELECTED(Dates),Dates[Loadingweek] <= MAX(Dates[Loadingweek])))

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

Hi @amitchandak ,

 

There is still no difference in the result.

goyalsa_0-1647924012187.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.