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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
StephenK
Resolver I
Resolver I

Burn Rate Over Time

Hello all,

 

Mgmt has tasked me with calculating a daily burn rate on single use items in our inventory. Essentially we want to calculate daily consumption over time for each facility.

Here is an example of my data:

IndexDateFacilityItemQtyAmount
13/28/2020AGlovesBox10
23/28/2020AGogglesEach10
33/28/2020AMasksEach50
43/29/2020AGlovesBox8
53/29/2020AGogglesEach5
63/29/2020AMasksEach35
73/30/2020AGlovesBox2
83/30/2020AGogglesEach7
93/30/2020AMasksEach23
103/28/2020BGlovesBox15
113/28/2020BGogglesEach11
123/28/2020BMasksEach25
133/29/2020BGlovesBox10
143/29/2020BGogglesEach15
153/29/2020BMasksEach35
163/30/2020BGlovesBox3
173/30/2020BGogglesEach6
183/30/2020BMasksEach9

 

Our measurement period is 7-14 days. Formula is: day 1 minus day 2, day 2 minus day 3, etc. Then the average of the measurement period is taken.

 

My problem is that, staff are entering new inventory along with the old inventory, so an item might decrease for a period of time and then suddenly jump up in amount. The formula assumes that no new stock is being entered. Anyone have any ideas on how I could do my calculation and adjust for new inventory in dax?

 

I was thinking something along the lines of an IF statement and utilizing the index column??

 

Thanks.

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

Just a thought, can you ignore the negatives? So if you have day 1 - day 2 and you have 10 and 8 for those values then you have used 2 but if the next entry is 50 then you would have 8 - 50, just ignore these, exclude them from your average calculation. You could get your column with:

 

Daily Use = 
  VAR __Date = 'Table'[Date]
  VAR __Item = 'Table'[Item]
  VAR __Facility = 'Table'[Facility]
  VAR __Qty = 'Table'[Qty]
  VAR __Amount = 'Table'[Amount]
  VAR __Next = 
    MAXX(
      FILTER(
        'Table',
        [Date] = (__Date + 1) * 1. && 
          [Item] = __Item &&
            [Facility] = __Facility &&
              [Qty] = __Qty
       ),
       [Amount]
     )
  VAR __Diff = __Amount - __Next
RETURN
  IF(__Diff < 0,BLANK(),__Diff)

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

@Greg_Deckler  That's a great idea! I made a minor change because it was calculating the wrong way--

Before:

DateItemQTYFacilityAmountDailyUse
3/12/2020GlovesEAA152 
3/19/2020GlovesEAA152 
3/20/2020GlovesEAA134 
3/23/2020GlovesEAA1345
3/24/2020GlovesEAA139 
3/25/2020GlovesEAA1263
3/26/2020GlovesEAA129 
3/27/2020GlovesEAA117 
3/30/2020GlovesEAA324 

After:

DateItemQTYFacilityAmountDailyUse
3/12/2020GlovesEAA152 
3/19/2020GlovesEAA152 
3/20/2020GlovesEAA13418
3/23/2020GlovesEAA134 
3/24/2020GlovesEAA139 
3/25/2020GlovesEAA12613
3/26/2020GlovesEAA129 
3/27/2020GlovesEAA11712
3/30/2020GlovesEAA324 

 

Daily Use = 
  VAR __Date = 'Table'[Date]
  VAR __Item = 'Table'[Item]
  VAR __Facility = 'Table'[Facility]
  VAR __Qty = 'Table'[Qty]
  VAR __Amount = 'Table'[Amount]
  VAR __Next = 
    MAXX(
      FILTER(
        'Table',
------->>>[Date] = (__Date - 1) * 1. && 
          [Item] = __Item &&
            [Facility] = __Facility &&
              [Qty] = __Qty
       ),
       [Amount]
     )
  VAR __Diff = __Amount - __Next
RETURN
  IF(__Diff < 0,BLANK(),__Diff)

 

 

Thanks for your help!

View solution in original post

4 REPLIES 4
Greg_Deckler
Super User
Super User

Just a thought, can you ignore the negatives? So if you have day 1 - day 2 and you have 10 and 8 for those values then you have used 2 but if the next entry is 50 then you would have 8 - 50, just ignore these, exclude them from your average calculation. You could get your column with:

 

Daily Use = 
  VAR __Date = 'Table'[Date]
  VAR __Item = 'Table'[Item]
  VAR __Facility = 'Table'[Facility]
  VAR __Qty = 'Table'[Qty]
  VAR __Amount = 'Table'[Amount]
  VAR __Next = 
    MAXX(
      FILTER(
        'Table',
        [Date] = (__Date + 1) * 1. && 
          [Item] = __Item &&
            [Facility] = __Facility &&
              [Qty] = __Qty
       ),
       [Amount]
     )
  VAR __Diff = __Amount - __Next
RETURN
  IF(__Diff < 0,BLANK(),__Diff)

@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler  That's a great idea! I made a minor change because it was calculating the wrong way--

Before:

DateItemQTYFacilityAmountDailyUse
3/12/2020GlovesEAA152 
3/19/2020GlovesEAA152 
3/20/2020GlovesEAA134 
3/23/2020GlovesEAA1345
3/24/2020GlovesEAA139 
3/25/2020GlovesEAA1263
3/26/2020GlovesEAA129 
3/27/2020GlovesEAA117 
3/30/2020GlovesEAA324 

After:

DateItemQTYFacilityAmountDailyUse
3/12/2020GlovesEAA152 
3/19/2020GlovesEAA152 
3/20/2020GlovesEAA13418
3/23/2020GlovesEAA134 
3/24/2020GlovesEAA139 
3/25/2020GlovesEAA12613
3/26/2020GlovesEAA129 
3/27/2020GlovesEAA11712
3/30/2020GlovesEAA324 

 

Daily Use = 
  VAR __Date = 'Table'[Date]
  VAR __Item = 'Table'[Item]
  VAR __Facility = 'Table'[Facility]
  VAR __Qty = 'Table'[Qty]
  VAR __Amount = 'Table'[Amount]
  VAR __Next = 
    MAXX(
      FILTER(
        'Table',
------->>>[Date] = (__Date - 1) * 1. && 
          [Item] = __Item &&
            [Facility] = __Facility &&
              [Qty] = __Qty
       ),
       [Amount]
     )
  VAR __Diff = __Amount - __Next
RETURN
  IF(__Diff < 0,BLANK(),__Diff)

 

 

Thanks for your help!

Anonymous
Not applicable

Indeed, it would be a great idea if it was correct. But it's not. This calculation does not return the true numbers of usage but just "some" numbers that sometimes are correct and sometimes are not. What the average is... is not interpretable at all.

This is easy to prove. Let's say that on one day the number is 100. The next day it's 200. The truth is that the usage from 100 to 200 could be any number from 0 to 100. ANY NUMBER. What your calculation does is it ignores this completely, treating the day as non-existent in the calculation of the average.

That is certainly not a true-to-life calculation and can be way off.

Best
D
Anonymous
Not applicable

"My problem is that, staff are entering new inventory along with the old inventory, so an item might decrease for a period of time and then suddenly jump up in amount."

No, you can't do what you want because there is no way with the above data to know how many new items were added if they were added. If in a day some items were given away and some were added to the inventory, there is no way to know individual amounts from the total.

You have to explicitly capture both amounts.

Best
D

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors