Announcements
You can succeed best and quickest by helping others to succeed. Join the conversation.
cancel
Showing results for
Did you mean:
Not applicable

## nested if() value

Hey guys,

I'm struggling with an easy problem (I think it's easy anyway).

I've got a dimension called "group" with values "set1", "set2", "set3", ....

Each value has got it's own target (sales):

set1 = 10.000 euro

set2 = 20.000 euro

set3 = 30.000 euro

I've got a chart (table) that shows the current sales for each set. In the second column (second expression), it should show me the target for each set.

(I know I can add a new field, but I do not want to touch the codes).

So I was thinking something like:

=if (group = {'set1'}, 10000, if (group = {'set2'}, 20000, .... })

See where I am going? Like a nested if-function in Excel..

Does anyone know how to enter the expression?

Thanks a lot!

Zipke

1 Solution

Accepted Solutions
MVP

If I understand correctly, your idea should work:

=if (group = 'set1', 10000, if (group = 'set2', 20000, .... ))

or maybe like

=pick(match(group,'set1','set2'),

10000,

20000

)

edit:

Or just create a INLINE table in your script and use the associative logic:

group, target

set1, 10000

set2, 20000

];

Then just use an expression

=only(target)

4 Replies
MVP

If I understand correctly, your idea should work:

=if (group = 'set1', 10000, if (group = 'set2', 20000, .... ))

or maybe like

=pick(match(group,'set1','set2'),

10000,

20000

)

edit:

Or just create a INLINE table in your script and use the associative logic:

group, target

set1, 10000

set2, 20000

];

Then just use an expression

=only(target)

MVP

Put the expression simply like: = FieldNameWithTargetData

Or, if you want the numeric representation may try:    =Num(Subfield(TragetField, '.', 1))*1000

Not applicable
Author

Ha alright, the first part of you reply actually worked. It didn't work when I did it because of the {  } I used..

Thanks, I think I've got it already!

Will also try the other options! May be useful at some point in life

Not applicable
Author