I never benchmarked the performance of a Pick statement with so many embedded formulas, so I can't quite comment on that, but I noticed a quite extensive use of AGGR in your formulas, and it triggered an alert in my mind, considering your comment about millions of records...
While AGGR is a wonderful feature in QlikView, it can lead to a huge performance issue, when used carelessly. Examine your AGGR formulas and try to predict the number of possible values that the AGGR will have to produce. You should be safe if the number of distinct values is in thousands or even tends of thousands. You need to get more cautious if the number goes into hundreds of thousands, and you should think of another solution if you are looking at millions distinct values.
In addition, I have a hunch that thew way you implemented your formulas, using Pick and flexible functions, you might be causing each cell in your Straight table to perform its own AGGR calculation, and that's causing the explosive growth in the memory consumption.
We all like dynamic solutions that are slick and elegant, but at times they are not very scale-able for larger volumes of data. In those cases, we might have to resort to simple, even if less elegant, solutions.