Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
having an expression like Above(Sales,1,3) I would like to be able to continue to work with the resulting "Array" or "Range" of the result.
For example I want to Aggregate that range in a way, the Range functions do not offer:
Concat( Above(Sales,1,3) , ';' )
or do calculations on them and then aggregate:
RangeSum( Above(Sales,1,3) > 500 )
How would that be possible?
And if not, would it be possible with Macros+VBScript? If yes, how?
PS: Working with QlikView
I'm not quite sure what do you want to do but I think most of your calculations will be possible with a combination of a range- and interrecord-function like rangesum() and above(). Maybe you are missing an inner aggregation and/or a TOTAL within the above - I mean something like this:
RangeSum(Above(TOTAL sum(Sales),1,3)) > 500
which should be return a true or false for this comparing and by including it within an if-loop you could decide what should be done respectively returned.
- Marcus
What do you be able to share few rows of data with the expected output from it?
Hi Marcus,
It might have been misleading to use "Sales" in my example, because in most examples a table shows the aggregation "Sum(Sales)".
However, it doesn't make a difference - Let's assume, I just have a single Sales value per row:
Name | Sales |
---|---|
Alf | 80 |
Ben | 10 |
Charlotte | 50 |
Dora | 30 |
Elvis | 20 |
I want to do for every row the following:
Take the X (lets say 3) rows above me (Above(Sales, 1, 3)) and compare each with a value Y (lets say 25).
I would have for Elvis (using >25) an Array: [True, True, False]; for Charlotte: [False, True].
With that Array I want to continue working.
Just an example: Count, how often it is True
PS: Is there a way to edit my initial question to clarify it?
Maybe this one:
- Marcus
Brilliant application of the associative and commutative property.
I will see, how far I can get with that.
Thank you.
I just realized, that this only solves one of the Questions,
but how would you do the second, with the concatenate?
So we can have for elvis the string "30-50-10", for Dora: "50-10-80".
Something like this
Or this