Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
valnod_90
Contributor III
Contributor III

GetFieldSelections question

Hello everyone, I hope you can help me. Smiley Happy


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

Labels (2)
1 Solution

Accepted Solutions
valnod_90
Contributor III
Contributor III
Author

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 🙂

View solution in original post

9 Replies
rbartley
Specialist II
Specialist II

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
Contributor III
Contributor III
Author

Hi, i've tried but it doesn't work. 😞
rbartley
Specialist II
Specialist II

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
Master II
Master II

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
Contributor III
Contributor III
Author

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
Specialist II
Specialist II

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
Contributor III
Contributor III
Author

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

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
Contributor III
Contributor III
Author

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 🙂