FIRSTOCCURANCE should happen based on High number

Hi All,

 

Is it possible to get FIRSTOCCURANCE based on Highest Number?

 

As per the below Example:

1. "PRODUCT A" has the Highest Transaction number- 4,000 in the second Hierarchy(Bucket 2). "PRODUCT A" Will TRUE Under BUCKET 2 Parent.

2. "PRODUCT C" has the Highest Transaction number- 3,000 in the first Hierarchy(Bucket 1). "PRODUCT A" Will TRUE Under BUCKET 1 Parent.

Capture.PNG

 

Please suggest.

 

Regards,

Uma

 

Answers

  • @g.mahesh Uma

    I really like this use case, great question Uma. When I look at what you're trying to do it looks like you want Product A with the highest value to show first. If that's the case, I would recommend using the RANK() function.

    https://help.anaplan.com/4f94f2e7-e7d9-4bae-ba6f-2b872e8d9189-RANK

    You will need a Boolean line item that looks for RANK = 1. Than you can filter on the Boolean.

    Hope that helps!

  • @g.mahesh 

     

    I am coming at this from a different position than @JaredDolich.. Take a look at the below as I think this will work for you, but in order for it it work, you have to have the architecture correct.

     

    First, on your hierarchical list, make sure it is a numbered list (I am sure you already have that), with the the Display Name being list formatted to a Flat list (in my case Products)

     

    Composite List numbered list:

    2021-02-07_09-50-37.png

     

    Display Name format

    2021-02-07_09-50-47.png 

     

    Flat List (Product)

    2021-02-07_09-51-00.png

     

    Data Module

    2021-02-07_09-53-37.png

     

    Now the magic.  Create another module which is dimensionalized by Product (my flat list which is used by the Display Name in the composite list).  Create a line item, I named it Max with the formula: GMesh.Value[MAX: 'P2 Product'.Display Name]

     

    2021-02-07_09-55-10.png2021-02-07_09-55-20.png

    Now, go back to the original module and create a new line item, (Is First?) formatted as Boolean with the formula: Value = GMesh Max.Max[LOOKUP: 'P2 Product'.Display Name]

     

    2021-02-07_09-58-12.png

     

    This is will work better than the Rank function because a) I am not sure Rank will get you where you want to go and b) this is solving the issue with dimensionality which will be more scalable.

     

    Hope this helps,

     

    Rob

     

  • Sweet, @rob_marshall 

    An exquisite solution!

  • @JaredDolich 

     

    So I was thinking about my comment that this couldn't be used with Rank and it really bugged me.  I did prove it out to work with Rank, but i still don't think it should be used due to the overhead that Rank adds.

     

    2021-02-08_11-45-31.png2021-02-08_11-45-40.png

     

    Rob

  • @rob_marshall 

    Your solution makes complete sense. RANK, I imagine, is much more processing intensive than MAX. 

    @g.mahesh use case lends itself nicely to MAX. However, if the conditions change where they want the top 2, or they want just the second, they can may have to use RANK. 

    This is the joy of Anaplan, IMHO. So many options to fit the requirements, some better than others. Always learn something new from you @rob_marshall. Thank you!!