Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
alwinsch
Creator
Creator

Sum variables with set analysis

Hi all,

how do i make a sum with set analysis, that uses a variable that also is a sum with set analysis.

for example

Vcomm = sum({<Type = {1,2}> Comm}

and know i want to use this variable in the following expression:

Sum({<Year = {2016}>} $(Vcomm) )

But it does not work, although the syntax of the expression is correct.

How can i resolve this? I use the Variable Vcomm in many different graphs and tables, so i cannot change it.

Kind regards,

Alwin

4 Replies
marcus_sommer

In this way you tried to nest aggregations which aren't allowed without the use of an aggr-wrapping. I'm not sure if it's make much sense to implement this instead of simply using:

Sum({<Year = {2016}, Type = {1,2}>} Comm )

- Marcus

alwinsch
Creator
Creator
Author

and how does this aggr_wrapping work? Because my variable is in real life not that simple as described above.

-Alwin

marcus_sommer

It would need to look something like this:

Vcomm = aggr(sum({<Type = {1,2}>} Comm), Dim1, Dim2)

Sum({<Year = {2016}>} $(Vcomm) )

For this you will need to specify the dimensions in which relation the inner aggregation should be performed and this kind of expression needs a lot more performance than a normal set analysis expression and you shouldn't use them if they aren't mandatory necessary: When should the Aggr() function NOT be used?

I think you could rather need variables with parameter. This and many more about variables could you find here: Variables.

- Marcus

alwinsch
Creator
Creator
Author

thanks for the help,

i did it the easy way, without aggr and followed your first post.

-Alwin