Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

Calculated Variable

Hi,

I would like to hand over the value of one variable to another, and tried it with following let statement, which does not work?

(vCountry_Count = 1)

LET vPeeking = $(vCountry_Count);

Additinal question, once this is working I would like to  deduct -1 from Country_Count in the vPeeking Variable.

Labels (1)
1 Solution

Accepted Solutions
Highlighted
MVP & Luminary
MVP & Luminary

Re: Calculated Variable

(vCountry_Count = 1)

is not a valid script statement and will return a null result. A valid statement would be without the () and an added; 

vCountry_Count = 1;

This defaults to LET and I recommend you explicitly code either LET or SET.  There is no need to favor LET over SET unless you are calculating an expression.  So a valid set of statements would be:

SET vCountry_Count = 1;
SET vPeeking = $(vCountry_Count);

And to subtract 1 from vPeeking:

LET vPeeking = $(vPeeking) - 1;

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

 

View solution in original post

2 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Calculated Variable

(vCountry_Count = 1)

is not a valid script statement and will return a null result. A valid statement would be without the () and an added; 

vCountry_Count = 1;

This defaults to LET and I recommend you explicitly code either LET or SET.  There is no need to favor LET over SET unless you are calculating an expression.  So a valid set of statements would be:

SET vCountry_Count = 1;
SET vPeeking = $(vCountry_Count);

And to subtract 1 from vPeeking:

LET vPeeking = $(vPeeking) - 1;

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

 

View solution in original post

Highlighted

Re: Calculated Variable

Perhaps this?

Set vCountry_Count = 1;

LET vPeeking = $(vCountry_Count)-1;

 

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)