Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dynamic metric selection in text box

Hi All,

I want to display avg value of selected metric in text box.

I have created inline table having 5 metrics as those i have in table(database)

I have a list box having those five metrics,i want on selection in list box i should get  value in text box.

Inline table:  

MetricsOptions1:

LOAD * INLINE [MetricsNo,Metrics

1,Investment as % of GDP

2,Revenue % of GDP

3,Expenditure % of GDP

4,Net Debt % of GDP

5,CA Deficit % of GDP

];

Variable:- vGDPbased=Metrics

TextBox:-      =num(avg({<Country={'Brazil'}>}vGDPbased),'#.##%')

But i am getting '-' in text box

Please help me

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Try defining your variable vGDPbased as = '[' & Metrics ']'. And change the expression to =num(avg({<Country={'Brazil'}>} $(vGDPbased)) ,'#.##%')

See attached qvw for an example.


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
whiteline
Master II
Master II

Hi.

There are some mistakes.

First, 'Investment as % of GDP' is not an expression to get the Investment as % of GDP.

You have to add another field and write correct expressions for calculating each metrics.

Then use it instead of Metrics field.

Second, to substitute the vGDPbased value, you have to use $-sign expansion:

TextBox:- =num(avg({<Country={'Brazil'}>} $(vGDPbased)),'#.##%')

Gysbert_Wassenaar

Try defining your variable vGDPbased as = '[' & Metrics ']'. And change the expression to =num(avg({<Country={'Brazil'}>} $(vGDPbased)) ,'#.##%')

See attached qvw for an example.


talk is cheap, supply exceeds demand