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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Use of variable in aggr

Hi All,

Can we use variable to aggregate over that defined variable. ?

Ex , I have created a variable with name vDate. I want to write sum(aggr(sum(Sales),vDate))

Thanks,

Sailee

3 Replies
Not applicable
Author

Hi,

sum(aggr(sum(Sales),vDate))

here you can use variable but vDate must be a Filedname not a value.

like this

set vDate=Year

sum(aggr(sum(Sales),vDate))

vikasmahajan

your expression is wrong 

you can use like this

sum(aggr( (SUM({$< FiscalYear={$(=max(FiscalYear))},[Posting Date] = {'<=$(=Date(vDate))'}>}[Sales]) ))

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
MayilVahanan

Hi

Try like this

sum(aggr(sum(Sales), $(vDate)))

Hope vDate is the Field Name.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.