Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

robbiewottie
New Contributor II

Set Analysis in calculated variable

Hi Guy,

I have a variable wich is set and calculated as Include statement in the script

vProject# = sum({$<[ForecastCategoryName] = {'Pipeline'},DateType = {'Snapshot Date'}>}[# Opportunity])

And the front end expression of the chart is defined as $(vProject#)

But now i have several dimensions like country and year which a want to slice and dice trough this calculation in the frond end

How do i write this properly?

sum({$<[Year] = {'2016'},($(vProject#)) will not work. Pls advice

Thanks!

Robbie

5 Replies
greeshma_k
Contributor III

Re: Set Analysis in calculated variable

Try this

$(=only({$<[Year] = {'2016'}>}vProject#)

Regards,

Greeshma

robbiewottie
New Contributor II

Re: Set Analysis in calculated variable

Nope,

No resuls

miguelbraga
Valued Contributor III

Re: Set Analysis in calculated variable

Hey there,

First of all, your set analysis expression is wrong and invalid and it will return null. Try maybe, tweak it a bit like this:

sum({$<[ForecastCategoryName] = {'Pipeline'},DateType = {'Snapshot Date'}, [Year] = {'2016'} >} [# Opportunity])


With these you can do what you want


Regards,

MB

Re: Set Analysis in calculated variable

Perhaps This

=sum({$<[Year] = {'2016'} $(vProject#))


OR For testing check this

Aggr(sum({$<[Year] = {'2016'} $(vProject#)),[ForecastCategoryName])

or

Would you able to provide sample

Life is so rich, and we need to respect to the life !!!
MVP
MVP

Re: Set Analysis in calculated variable

No matter how you want to massage your expression

=sum({$<[Year] = {'2016'},($(vProject#))

you will not get that to work, as this a nested Sum statement which is not allowed.


You can go with miguelbraga‌'s solution above, or  you could try

=Sum({$<[Year] = {'2016'}>} Aggr($(vProject#), Year, chartdim1, chartdim2, ...))


Where chartdim1, chartdim2 is comma separated list of all (one or more ) the chart dimensions.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Community Browser