Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an expression that calculates the amount per Report Date.
Sum({$<%Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month = >} [Amount])
I would like to save the set analysis expression (just the point in time expression) into a variable since I will need it in multiple places in the document and possibly on other documents too. I tried the following but none of them works
set vCurrentPeriod = %Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month =;
OR
set vCurrentPeriod = '%Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month ='
My goal is to be able to do this on the expression:
=Sum({$<$(vCurrentPeriod)>} [Amount])
Any help is greatly appreciated.
Try
LET vCurrentPeriod = '%Report_Date_Id = {$' & '(=Max(%Report_Date_Id))}, Year = , Quarter = , Month =';
Try
LET vCurrentPeriod = '%Report_Date_Id = {$' & '(=Max(%Report_Date_Id))}, Year = , Quarter = , Month =';
press ctrl+alt +v
and create variable over there and doesnot give = sigh before
=%Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month = -->>>> wrong method
%Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month = ------>>Correct method
now u can use
Sum({$<$(vCurrentPeriod)>} [Amount])
Thanks Kumar I was able to make this work using this approach. I wanted to save this in a .qvs file so I'll have to do the assignment in script.
Thanks Gysbert Wassenaar this solved my problem. I did notice that when I was using the SET, the value stored when I look at the variable overview screen is different than what I assigned in the script. It looks like this...
vCurrentPeriod = '%Report_Date_Id = {}, Year = , Quarter = , Month =
I don't know what's happening but it is dropping the dollar expansion expression inside the curly braces. But using LET and breaking it into 2 strings somehow worked. Would you explain the logic behind that?
then once try this
set vCurrentPeriod = '%Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month =' ;
or else
write in excel and peek it from there ![]()
Hi,
You can use ASCII values along with LET statement. Something like this...
| LET vMyExpression = 'Sum({<%Report_Date_Id = {' & Chr(36) & '(=Max(%Report_Date_Id))}, Year = , Quarter = , Month = >} [Amount])'; | |
Thanks,
DV
www.QlikShare.com
I had this originally but it does not work.
set vCurrentPeriod = '%Report_Date_Id = {$(=Max(%Report_Date_Id))}, Year = , Quarter = , Month =' ;