Qlik Community

Qlik Sense App Development

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

Highlighted
valnod_90
New Contributor III

GetFieldSelections question

Hello everyone, I hope you can help me. :smileyhappy:


I created a filter using this field:

=[VE.Order Date.autoCalendar.Year]

in the "Budget" measure I inserted this expression:

if(GetFieldSelections([VE.Order Date.autoCalendar.Year])='2016', 1000, 1160)

so if I select 2016 I would like to see the value of 1000 under the Budget label, but this does not happen.

Where am I doing wrong?

I attach an image for greater clarity

Thank you

 

Sells.png

1 Solution

Accepted Solutions
valnod_90
New Contributor III

Re: GetFieldSelections question

I've done it!
I created a calculated column in the table
OrderYear = year (OrderDate)
and in this way it worked, I do not know what problems it had with the other mode.

Thank you all for your help 🙂

9 Replies
rbartley
Valued Contributor

Re: GetFieldSelections question

Hi,

Is Year stored as a string or a number?  Have you tried the following without the apostrophes (single quotes)?

 if(GetFieldSelections([VE.Order Date.autoCalendar.Year])=2016, 1000, 1160)

valnod_90
New Contributor III

Re: GetFieldSelections question

Hi, i've tried but it doesn't work. 😞
rbartley
Valued Contributor

Re: GetFieldSelections question

I've just created a new app and added manual data with just one field (Year) and three values 2015,2016 and 2017.  I then added a filterpanel containing Year as dimension and a KPI with the definition: 

if(GetFieldSelections([VE.Order Date.autoCalendar.Year])='2016', 1000, 1160)

This works fine whether I use single quotes or omit the quotes.  Could you please post your app?  In the meantime, is the year field you are using linked with any other data table?

 

pradosh_thakur
Honored Contributor II

Re: GetFieldSelections question

select 2016 and check what is the value for GetFieldSelections([VE.Order Date.autoCalendar.Year]) to find where the issue is .

The above solution provided should work anyway.
Learning never stops.
valnod_90
New Contributor III

Re: GetFieldSelections question

I can not post the app, but I can say that the sales table is linked to others but not using the year field.

rbartley
Valued Contributor

Re: GetFieldSelections question

Ok, as per the suggestion above.  Create a text box or add a column to an existing table with the definition GetFieldSelections([VE.Order Date.autoCalendar.Year]) , select Year 2016 and see what the result of this expression is.

 

 

valnod_90
New Contributor III

Re: GetFieldSelections question

I created the text box as shown but it does not work, nothing appears by selecting the year.
rbartley
Valued Contributor

Re: GetFieldSelections question

Have you selected the field from the field list? Is it possible that you have made a mistake typing in the field name?

Why don't you try duplicating the app, deleting all of the tables other than the one containing the Year field and see what happens? If still not working, then post the reduced app, removing any sensitive data.
valnod_90
New Contributor III

Re: GetFieldSelections question

I've done it!
I created a calculated column in the table
OrderYear = year (OrderDate)
and in this way it worked, I do not know what problems it had with the other mode.

Thank you all for your help 🙂