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.
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:
Display Name format
Flat List (Product)
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]
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]
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.
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.