Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
kashjaniqlik
New Contributor III

Using variables in Straight table

Hello

I have a variable to do a sum of a field in my data model. The result is then split by another field in the column

For e.g. Sum of total customers. This is then split by countries.

UK - 500

US - 300

Total - 800


If I use a straight table with Countries as dimension and =SUM(totalcustomers) as expression, this works all OK.

If I then use a variable to store the sum of total customers and use this variable as expression, the straight table doesn't seem to split by countries. It shows the total customers for all countries.

UK - 800

US - 800

Please see attached.

Thanks

1 Solution

Accepted Solutions
MVP
MVP

Re: Using variables in Straight table

try to read here

The Magic of Variables

6 Replies

Re: Using variables in Straight table

Have you used the '=' when defining your variable? Try '=Sum(totalcustomers)' vs 'Sum(totalcustomers)'

mphekin12
Valued Contributor

Re: Using variables in Straight table

Can you post a sample of your app?

MVP
MVP

Re: Using variables in Straight table

try to read here

The Magic of Variables

kashjaniqlik
New Contributor III

Re: Using variables in Straight table

Hi Sunny

Yes all variables are defined with an "=" sign.

SET vTotalCustomers = '=SUM(TotalCustomers)';

Thanks





kashjaniqlik
New Contributor III

Re: Using variables in Straight table

Thanks Massimo‌

MVP
MVP

Re: Using variables in Straight table

try with one of

Set vTotalCustomers = Sum(TotalCustomers) ;

Let vTotalCustomers = 'Sum(TotalCustomers)' ;

and then as expression in chart

$(vTotalCustomers)

Community Browser