Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Not applicable

suming variables in expressions

Hi guys,

I saw in a qlikview example "whats new in qlikview 11" that you could create "slect one metric" for sales, quantity, margin...etc..

The way they did it:


LOAD * INLINE [_metricsNo, _metrics

1, Sales,

2, Qty,

3, Margin

4, Margin%




    _metrics as _metricPickOne

RESIDENT MetricsOptions;

My question is, if I wanted to sum up sales in a expression but don´t want to hardcode sum(sales) but instead wanted to use the Metrics Options, how do I do that? I tried sum(_metricPickOne) but that didn´t work.

I know I can use condition and say _metricPickOne = 'sales'     than sum(sales) but what if I have more than 10 metrics? Is there another way?



5 Replies
Not applicable

Re: summing variables in expressions

If you Select one value from either your _metricsNo or _metrics fields then this expression would work:


or sum($(=_metrics))


Re: summing variables in expressions

The safest way to code this would be to use minstring() instead of only(). This way, no selection will still work and it will also protect against losing the one and only one selection (which I would recommend) on _metrics.

Not applicable

suming variables in expressions

If I create a text box in the example and try your solution, i get the null sign '-'.

Not applicable

suming variables in expressions

sum($(=minstring(_metrics))) will work but the problem is you well always get the same number no matter whether you choose sales, Qty, Margin or Margin%. Thats because minstring(_metrics) always returns Margin

MVP & Luminary
MVP & Luminary

suming variables in expressions


MinString() returns minumum value in the list,

If you select a value then it returns selected value. 

If you select multiple values then it minimum value in the selected values.

If you do not select any values then it returns minimum values of the overall list.

Hope this helps you.