cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Help getting value of a measure based on category index

I have three measures AveOnHand (beg inventory for batch), Needs (cumulative demand by date) and Balance ([AvgOnHand]-[Needs]).  I am working with dated batches of product. I need to add the final value of Balance from the oldest batch (index 4) to the beginning inventory of the next batch (index 5.)  In the following example, I need to add -750 to 1227. 

PowerBiHelp.jpg

How might I accomplish this? I've spent lots of time searching around and trying various Dax solutions, but I can't get the desired result.

Thanks for any help!

 

 

 

1 REPLY 1
Highlighted
Super User IV
Super User IV

Re: Help getting value of a measure based on category index

First, Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490.

 

Second, 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...

 

Third, it is probably something like:

Column =
  VAR __Batch = [Index]
  VAR __PreviousBatch = [Index] - 1
  VAR __OldestPreviousDate = MAXX(FILTER('Table',[Index] = __PreviousBatch),[FutureProdDate])
  VAR __PreviousBalance = MAXX(FILTER('Table',[Index] = __PreviousBatch && [FutureProdDate] = __OldestPreviousDate,[Balance])
  VAR __OldestCurrentDate = MAXX(FILTER('Table',[Index] = __Batch),[FutureProdDate])
RETURN
  IF('Table'[FutureProdDate] = __OldestCurrentDate,[Balance] + __PreviousBalance,[Balance])
  

 


---------------------------------------

Putting square pegs in round holes since 1972.

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors