Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I have following Variable in QV document
vSale=Sum({<Type={'SA'}>}Sales)
I want to use that variable in the following expression in my Pivot Table
sum({<PERIODID={"<=$(=Max(PERIODID)-1)"},YEAR =,QUARTER =,MONTH =,PERIOD =>}$(vSale))
But When I write the expression it returns Zero Value. Kindly help me to rectify it
Hi, you can not use Sum function within Sum function, for that you need to use the Aggr function.
Try debugging the expression step by step.
Create a text object for $(vSale) to ensure that the variable is calculated correctly. Make sure that the field names in the set expressions are correct and exist in your data model.
Thanks for Your reply. However I am new to qlikview I can not figure out how write my expression' Kindly rewrite the expression to suit my requirement
Thanks
Hi
Try like below
Method 1:
VariableName:vSale
Value: Sales [Without equal sign]
sum({<PERIODID={"<=$(=Max(PERIODID)-1)"},YEAR =,QUARTER =,MONTH =,PERIOD =, Type={'SA'}>}$(vSale))
or
VariableName: vTypeSA
Value: Type={'SA'} [Without equal sign]
sum({<PERIODID={"<=$(=Max(PERIODID)-1)"},YEAR =,QUARTER =,MONTH =,PERIOD =, $(vTypeSA)>}Sales)
Both will work. If you want to use like ur variable, you need to use like blelow
sum({<PERIODID={"<=$(=Max(PERIODID)-1)"},YEAR =,QUARTER =,MONTH =,PERIOD =, Type={'SA'}>} Aggr($(vSale), urdimension))
However, i think, its not optimistic.