Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
JustinDallas
Specialist III
Specialist III

Match List in If Statement

Hello Everyone,

I've got a UI where my expression for my dimension used to look like this

If(stp_event = {'IEMT'},

  [Origin City],

    Null()

)

This worked like a charm, but then I found out that I have more "stp_event"s to match against for my requirement.  So I then went and did this.

LET.PNG

And then in my UI.  I have this statement which doesn't work.

LETNOT.PNG

Mind you, the UI behaves as expected when vEmptyBlahBlah = 'IEMT' just not when I add that ,BBT.

Any help is greatly appreciated.

6 Replies
aarkay29
Specialist
Specialist

May be this:

If(Stp_Event =Subfield($(VEmptyStopEventTypes),',',1) Or Stp_Event =Subfield($(VEmptyStopEventTypes),',',2) , [Origin City], Null())

antoniotiman
Master III
Master III

Hi Justin,

try

SET vEmptyStopEventTypes = 'IEMT','BBT' ;

If(Match(Stp_Event,$(vEmptyStopEventType)),[Origin City],Null())

Regards,

Antonio

passionate
Specialist
Specialist

HI,

Please use this expression:

Pick(Match(stp_event,'IEMT','BBT')+1,'Null()','[Oigin City]','[Oigin City]')

Regards,

Pankaj

Kushal_Chawda

try like below

change variable

LET vEmptyStopEventTypes='IEMT','BBT'

then try below

If(match(stp_event , $(vEmptyStopEventTypes)),

[Origin City],

Null()

)

jagan
Luminary Alumni
Luminary Alumni

Hi Justin,

If there are multiple values then you have use Match() like below

  1. If(Match(stp_event, $(vEmptyStopEventTypes))
  2.   [Origin City], 
  3.     Null() 
  4. )

It is always better to avoid calculated dimension because of performance issues, instead you can solve this by using set analysis like below

Dimension: stp_event

Expression: Sum({<stp_event={$(vEmptyStopEventTypes)}>} FieldName)

Hope this helps you.

Regards,

jagan.

JustinDallas
Specialist III
Specialist III
Author

Hi Antonio,

This is the correct answer, the SET part is key.  But I don't seem to be able to mark this as "Correct Answer".