Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Variable

Hi Friends

 

I have created following variable

vSale=sum({<RC_R_TYPE={'DIRECT','FT'}>}RC_AMOUNT)+sum(CS_AMOUNT)

 

But when I write an expression with that variable it does not show any value

My Expression  

sum({$<PERIODID = {$(=Max(PERIODID))},YEAR =,QUARTER =,MONTH =,PERIOD =>}($(vSale)))

Please help me to correct my error

 

 

5 Replies
Vegar
MVP
MVP

You have nested sums: sum(sum()) 

Qlikview don't allow that. A work around is to put an aggregation aggr() in between. 

Like this :  Sum (aggr(sum())) 

upaliwije
Creator II
Creator II
Author

Thanks 

I modified it like below

sum(aggr(sum({$<PERIODID = {$(=Max(PERIODID))},YEAR =,QUARTER =,MONTH =,PERIOD =>}($(vSale)))))

still not working

Vegar
MVP
MVP

I'm sorry, I might not been very precise .  You need an structured parameter (a field) to aggregate over when using aggr(). Take a look at this page to understand the aggr() functionality.  https://help.qlik.com/en-US/qlikview/April2020/Subsystems/Client/Content/QV_QlikView/ChartFunctions/...

upaliwije
Creator II
Creator II
Author

Thanks for your advice. I still can not find a solution for my issue

upaliwije
Creator II
Creator II
Author

I have following Pivot Table

upaliwije_0-1612419502220.png

Column 1 has the following expression

sum({$<PERIODID = {$(=Max(PERIODID))},YEAR =,QUARTER =,MONTH =,PERIOD =,RC_R_TYPE={'DIRECT','FT'}>}RC_AMOUNT)

Column2 has the following expression

sum({$<PERIODID = {$(=Max(PERIODID))},YEAR =,QUARTER =,MONTH =,PERIOD =>}$(vTsale))

My variable 

 $( vTsale)=sum({<RC_R_TYPE={'DIRECT','FT'}>}RC_AMOUNT)

My Column 2 does not show any value. Can you please help me to correct my Column 2  Expression