Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
MT4T
Creator
Creator

Multi variables used in one

Hey,

I need to do bellow calculation in load script. But I have issue with syntax.

 

LET vIndirect = '14719,65';
LET vPakA = '19234,77';
LET vPakB = '18793,12';
LET vSortA = '15199,00';
LET vSortB = '19755,00';

LET vPRC_CST_0001X = ((vIndirect + (RANGEAVG(vPakA, vPakB) + RANGEAVG(vSortA, vSortB)) / '20.8') / '50');

Labels (2)
1 Solution

Accepted Solutions
marcus_sommer

You couldn't calculate with strings. Further some numbers are wrongly specified with a comma. Also it's best practice to use a $-sign expansion by a variable-call. Therefore it may look like:

SET vIndirect = 14719.65;
SET vPakA = 19234.77;
SET vPakB = 18793.12;
SET vSortA = 15199.00;
SET vSortB = 19755.00;

LET vPRC_CST_0001X = (($(vIndirect) + (RANGEAVG($(vPakA), $(vPakB)) + RANGEAVG($(vSortA), $(vSortB))) / 20.8) / 50);

View solution in original post

2 Replies
Mark_Little
Luminary
Luminary

Hi,

I believe you only need the ' when setting a string so i would remove them as start. 

LET vPRC_CST_0001X = ((vIndirect + (RANGEAVG(vPakA, vPakB) + RANGEAVG(vSortA, vSortB)) / 20.8) / 50)

marcus_sommer

You couldn't calculate with strings. Further some numbers are wrongly specified with a comma. Also it's best practice to use a $-sign expansion by a variable-call. Therefore it may look like:

SET vIndirect = 14719.65;
SET vPakA = 19234.77;
SET vPakB = 18793.12;
SET vSortA = 15199.00;
SET vSortB = 19755.00;

LET vPRC_CST_0001X = (($(vIndirect) + (RANGEAVG($(vPakA), $(vPakB)) + RANGEAVG($(vSortA), $(vSortB))) / 20.8) / 50);