Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I have the following variable
NUM(SUM({<sam_type={ALLOCATION}, sam_fiscal_year = {'$(=CurrentFiscalYear)'} >} sam_volume), '#,##0.00')
This works if i create it in the Variable Overview, but if i try and create it in the script instaed i get an internal error when i look at it in the variable overview after a reload.
i am trying this
SET vAllocation_FullYear = NUM(SUM({<sam_type={ALLOCATION}, sam_fiscal_year = {'$(=CurrentFiscalYear)'} >} sam_volume), '#,##0.00')
Does anyone know what i am doing wrong please?
The problem is that Qlikview will dollar-expand $(=CurrentFiscalYear) and try to evaluate it. That returns an error which then ends up in the variable.
Try:
SET vAllocation_FullYear = NUM(SUM({<sam_type={'ALLOCATION'}, sam_fiscal_year = {'^(=CurrentFiscalYear)'} >} sam_volume), '#,##0.00');
LET vAllocation_FullYear = replace('$(vAllocation_FullYear)','^','$');
edit: works for me. see attached qvw
Hi Gysbert,
That doesnt work unfortunately, If i look at the variable in the variable overview window i see the following..
NUM(SUM({<sam_type={' 'ALLOCATION' '}, sam_fiscal_year = {' '$(=CurrentFiscalYear)' '} >} sam_volume), ' '#,##0.00' ')
Note: i have put spaces above so you can see they are 2 single quotes throught the expression.