Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Upali_Wijearatne
Contributor III
Contributor III

Variable

Hi Friends

I have created following variable in QV document

vSpq=sum({<PRD_FLG={'I'}>}CP_QTY)

I want to use above variable in expression of my pivot table which is as follows

SUM({<PERIOD={$(=Max(PERIODID))}>}$(vSpq))

How no results are shown 

Upali_Wijearatne_0-1614408574546.png

Pls help me to identify the error and let me have correct expression please

 

3 Replies
PradeepK
Creator II
Creator II

You cannot use nested aggregation like this.. i.e. Sum(Sum()).. look into Aggr() function to use nested aggregation.

In your case try

SUM({<{<PRD_FLG={'I'},PERIOD={$(=Max(PERIODID))}>}CP_QTY)

 

Upali_Wijearatne
Contributor III
Contributor III
Author

Thanks 

Could you suggest me to write the expression with a variable

 

 

PradeepK
Creator II
Creator II

If you want more control / dynamic variables; look into parameterised variables!

Example for reference -

vVariable = SUM( {<PRD_FLG={'I'},PERIOD={$(=Max(PERIODID))}>} $1 )

Call parameterised variables

$(vVariable(CP_QTY))