Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
satishsure
Contributor
Contributor

Using variable for Field value(Column) in Set Analysis

I have variable called $vYearTotal. and I need to use in set expression to fetch for previous year.

=sum( {1<Year = {2015}>} $(vYearTotal) ).


I am trying to create new column using the above set expression.Not working for me.

11 Replies
sunny_talwar

How do you define vYearTotal?

satishsure
Contributor
Contributor
Author

Getting from another expression below
Num(

Sum( {$< Flag={1}, Year=, Quarter=, Month=, [Quarter In Year]=, [Month In Quarter]=>} $(vSelectField)

) / [Div],

Pick(WildMatch([Div], 1, 1000, 1000000), '#,##0', '#,##0', '#,##0.0')

)

sunny_talwar

You can try this

=Sum({1<Year = {2015}>} Aggr( $(vYearTotal), YourChartDimension))

satishsure
Contributor
Contributor
Author

Sunny..I don't have chart expression. As I need to create new Column $(vYearTotal) which should get results of previous year irrespective of selection.

=Sum({1<Year = {2015}>} Aggr( $(vYearTotal), YourChartDimension))

satishsure
Contributor
Contributor
Author

Sunny I have tried adding Aggr on Variable but no luck.Can some body suggest me.

satishsure
Contributor
Contributor
Author

Sunny..I have attached the qvw and Expression column is "Selection" in the Main straight table

sunny_talwar

What is this qvw showing my friend? I am not sure where is the variable vYearTotal

satishsure
Contributor
Contributor
Author

It is a front end variable

sunny_talwar

Is this not the requirement?

Sum({<Year = {2015}>}Aggr($(vYearTotal), Year))

Capture.PNG