Priority distribution

Hi All - 

 

Was hoping I could get some ideas/help on this problem that I'm trying to solve.  I am trying to automate the output of the "allocation" line item shown below.  I have a set amount that I need to distribute into various list items based on the priority shown.  The max amount allocated is shown in the first column.  I'm looking for a solution that can scale; assume that the list of items is large.  Not looking for logic that says something like "if priority = 1 then X else if priority = 2 then Y".  Hope this makes sense.

 

jbrass_0-1630438508719.png

 

 

Thanks,

Josh

Answers

  • @jbrass 

     

    When you say the list is large, what are we talking about?

  • Its likely not really a large list but I just wanted to make sure it was built in a way that could accommodate it if necessary.  I'm talking about the list of Items (Item 1, 2, 3, etc).  In actuality it likely would be a very small list (no larger than 50).

  • I figured it out.  I setup a rankcumulate on the "Max to Allocate" field using the priority field. Then, setup a boolean called "Include Whole Item?", which looks if the "Amount to allocate overall" > the rankcumulate.  Then another field called "Whole Item Amount", which is "IF 'Include Whole Item?' then Max to allocate else 0".   Then I setup another line item dimensionalized the same way as the "Amount to Allocate Overall" field, called "Remainder After Whole Item Allocation".  This is the "Amount to Allocate Overall" minus the Whole Item Amount.  Then I did a rank function back at the priority field, excluding the items that were TRUE in the "Include Whole Item?" line item.  I setup another boolean called "Include Partial Item?", and if the Rank function = 1, then this is TRUE ELSE FALSE.  This identifies the item that has an amount needed but that is less than the "Max to Allocate" amount.  Another line item called "Partial Item Amount" = IF Include Partial Item? THEN Remainder After Whole Item Allocation[LOOKUP: Contract] ELSE 0.  Final result is that the "Allocation" line item shown in my image = Partial Line Item + Whole Item amount.  Hopefully someone gets use out of this at some point 🙂