Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Partner
Partner

Date variable and measure declared in script

Hi Qlikers,

I'm trying to find a way to put measures in the script. This way it's easier to change expression instead of having to change each principal measure one by one or each variable one by one in the variable console.

Also I would like that this measures reacts depending on my date selecting in a variable. 

Please find attached the .qvf to have the proper exemple. How should I write my variables vSummaryDate so that it is properly displayed.

Thanks for your support

1 Solution

Accepted Solutions
Partner
Partner

Re: Date variable and measure declared in script

I found the solution using this:

 

LET vSummaryDate = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate1 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate1)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate2 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate2)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate3 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate3)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate4 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate4)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate5 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate5)'&chr(39)&'}>}STATUS_1MONTH)';

3 Replies
miskinmaz
Contributor III

Re: Date variable and measure declared in script

Instead of trying to add measures you can try to add the same measures in master visualization

 

Highlighted
Partner
Partner

Re: Date variable and measure declared in script

If I add in master visualization or master measures then I will have to change it one by one the day the calculation rules changes. It's easier in the script to perform replaces

Partner
Partner

Re: Date variable and measure declared in script

I found the solution using this:

 

LET vSummaryDate = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate1 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate1)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate2 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate2)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate3 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate3)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate4 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate4)'&chr(39)&'}>}STATUS_1MONTH)';
LET vSummaryDate5 = 'ONLY({<MEASURE_DATE={'&chr(39)&'$'&'(vCurrentDate5)'&chr(39)&'}>}STATUS_1MONTH)';