Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
danosoft
Specialist
Specialist

Item with "variable" name

Hi i wanna take in my text box a field of my table with name according with the selected year. I try to explain, i have these 3 fields:

FIELD1_2017

FIELD1_2018

FIELD1_2019

When i select my year filed (for example 2018), i want in  my text box i see : Sum(FIELD1_2019)

i know i can do that with some IF statement, but is possible in qlikview call a field composing it runtime with


name=FIELD1_ + selected year   ?  like Sum(FIELD1_[SELECTED_YEAR])

1 Solution

Accepted Solutions
marcus_sommer

In general the logic suggested from Eliran will work and probably there is just an issue with syntax. Personally I would probably use something like this:

sum($(='FIELD1_' & max(Year)))

to get also a working expression if more as one year is selected respectively possible.

Beside this it might be much easier if you transformed your crosstable into a "normal" table-structure per The Crosstable Load.

- Marcus

View solution in original post

5 Replies
eliran
Creator III
Creator III

Dear Daniele,

You can accomplish this with a variable easily:

vField==FIELD1_'&GetFieldSelections(Year)

sum($(vField)) inside the chart/text box.

BR,

Eliran.

danosoft
Specialist
Specialist
Author

Ok thanks, but it show me 0, if i show only the variable it show me correctly the name

vishsaggi
Champion III
Champion III

Can you share some sample data and your expected output here?

marcus_sommer

In general the logic suggested from Eliran will work and probably there is just an issue with syntax. Personally I would probably use something like this:

sum($(='FIELD1_' & max(Year)))

to get also a working expression if more as one year is selected respectively possible.

Beside this it might be much easier if you transformed your crosstable into a "normal" table-structure per The Crosstable Load.

- Marcus

danosoft
Specialist
Specialist
Author

Thanks, this is better becouse i can use it not only in variable, i didn't want create a lot of variable, in this way i can use it directly in my text script.

Thanks