Forum Discussion

StephenK's avatar
StephenK
Resolver I
6 years ago
Solved

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.

 

  • 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)
  • StephenK's avatar
    StephenK
    6 years ago

    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!

4 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    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)
    • StephenK's avatar
      StephenK
      Resolver I

      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's avatar
        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's avatar
    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