Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ziadm
Specialist
Specialist

Reference array of Variables

Hi

I have an array of variables and I have the index of the variable in a Field

The Array of variables

vRate1 = .4

vRate2=.5

vRate3=.6

I have the Value as Field and Seq (The Array index in the same Table)

I want to reference the following expression in my calculation

Fees = Value * $(vRate$(Min(Seq)) )

This does not work ..

IF statement will work fine but my array is going up to 70 indexes and it shorter to reference the index of the

variable ...

if(Seq = 1, Value * vRate1,if(Seq = 2, Value * vRate2))

Any help is appreciated

loveisfail@

1 Solution

Accepted Solutions
marcus_sommer

It's not possible in this way because you would need a $-sign expansion for it and those won't calculated on a row-level else global before your object is calculated and then applied to each row.

This meant you will need a conditional-statement to fetch your variables whereby a pick(match()) would be better than a nested if-loop. I mean something like:

pick(match(Seq, 1,2,3,...), $(vRate1), $(vRate2), $(vRate3), ...)

and such expression could be also outsourced in an expression-variable.

- Marcus

View solution in original post

6 Replies
Digvijay_Singh

May be this -

=Value * $(vRate$(=Min(Seq)))

ziadm
Specialist
Specialist
Author

Thanks Singh

Could you please check the attached Min(Seq) takes the entire sets in the chart

Digvijay_Singh

I don't have license to view qvw, can you share expression/image or whatever changes you made?

ziadm
Specialist
Specialist
Author

Add a chart with

Dimension = Seq

expressions :

Value

=Value * $(vRate$(=Min(Seq))) 

Rate :

= $(vRate$(=Min(Seq)))

See the rate values is always Min of the etire data set

Thanks

ziadm
Specialist
Specialist
Author

any idea

marcus_sommer

It's not possible in this way because you would need a $-sign expansion for it and those won't calculated on a row-level else global before your object is calculated and then applied to each row.

This meant you will need a conditional-statement to fetch your variables whereby a pick(match()) would be better than a nested if-loop. I mean something like:

pick(match(Seq, 1,2,3,...), $(vRate1), $(vRate2), $(vRate3), ...)

and such expression could be also outsourced in an expression-variable.

- Marcus