Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

ravishinge
Contributor

Multiply Variable and Field

hello Guys,

I want to multiply a Variable and a Field . Is it possible to do that ?

I have variables set as :- terminal and field as :- hours

I want to multiply these two things as a dimension expression and  show in a data sheet .

=$(v_Terminal)*Hours

This is not working .. Kindly help me with this

Thanks,

ravi

4 Replies
jpenuliar
Valued Contributor III

Re: Multiply Variable and Field

you have to make sure that $(v_Terminal) returns a value

avkeep01
Valued Contributor

Re: Multiply Variable and Field

Hi Ravi,

Have you tried NUM($(v_Terminal))*NUM(Hours)?

Probably $(v_Terminal) is causing the issue. Experiment with the following options:

$(=v_Terminal) * Hours

v_Terminal * Hours


Or when the v_Terminal is multiplied with multiple Hour fields, then use a function like SUM.

SUM($(v_Terminal) * Hours)

$(vTerminal) * SUM(Hours)

etc.


Good luck.



mark6505
Valued Contributor III

Re: Multiply Variable and Field

HI Ravi,

Check the above suggestion's i.e. The variable is returning the value you expect and also the are both numbers.

The next thign you have to take in to consideration is the Aggrations of the Hour field.

You will probably want something like

SUM(Hours)*$(v_Terminal) or SUM(Hours)*vTerminal - Depends on if your variable needs to be evaluated (dollar expanded)

Mark

ravishinge
Contributor

Re: Multiply Variable and Field

Thanks Guys,

Will try if it works , Thanks for your kind help