Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Use of Variable

Good afternoon!

I had been doing my first steps with Qlik Sense this week but I have a error when I use a variable and I don't understand the reason.

I have these variables:

LET numMutues = Count(nomMutua);

LET rangs = Floor(255/numMutues);

And my Load is here:

MutuesRGB:

LOAD ApplyMap('mMutues', "ID", 'No informado') as mutua,

$(rangs) as ValueRanged

FROM  [$(vPathQVD)Mutues.qvd](qvd);

How Can I use the variable into the "Load"?

Thanks for the help!

3 Replies
Anonymous
Not applicable
Author

What error are you getting ?

From quick look though, it appears you are not using a Qlik Sense data connection in your FROM bit, but using the QlikView explicit path method.

marcus_sommer
MVP
MVP

None of your displayed variables are used within the load and they won't work in this way either - starting with LET and assigning then an aggregation-function. Here you will find many valuable informations about Variables.

- Marcus

RadovanOresky
Partner Ambassador
Partner Ambassador

Hi,

I guess what you need is to do this:

SET numMutues = 'Count(nomMutua)'; // SET function defines a string which can be used in the script, you must use single quotes in this case.


SET rangs = 'Floor(255/$(numMutues))'; // dollar sign is needed to exchange the variable name by its content

But you will need to add a GROUP BY statement after FROM in your LOAD script, because you are using the Count() funcion. So something like this:

MutuesRGB:

LOAD ApplyMap('mMutues', "ID", 'No informado') as mutua,

$(rangs) as ValueRanged

FROM  [$(vPathQVD)Mutues.qvd](qvd)

GROUP BY "ID";


I do not completely understand what you want to achieve but hope this helps.


Regards,

Radovan