Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

if statement syntax

hi i have the following if statement that is not working.

i recieve the first two codes and no dates, however there should be a joined key.

ie . SEK20140101 , instead i recieve SEK or EUR only without the date, i guess i have a brackets issue.

Best Bras

If("TO_SHOP_NO" <= 299,'SEK',
If(("TO_SHOP_NO" >= 400 and "TO_SHOP_NO" <= 499) or ("TO_SHOP_NO" >= 610 and "TO_SHOP_NO" <= 699),'EUR',
If("TO_SHOP_NO" >= 600 and "TO_SHOP_NO" <= 609,'EEK'
&
Date(MakeWeekDate(Left(TO_PERIOD,4),Right(TO_PERIOD,2),0),'YYYYMMDD'))))

1 Solution

Accepted Solutions
jerem1234
Specialist II
Specialist II

Try:

If("TO_SHOP_NO" <= 299,'SEK',
If(("TO_SHOP_NO" >= 400 and "TO_SHOP_NO" <= 499) or ("TO_SHOP_NO" >= 610 and "TO_SHOP_NO" <= 699),'EUR',
If("TO_SHOP_NO" >= 600 and "TO_SHOP_NO" <= 609,'EEK')))
&
Date(MakeWeekDate(Left(TO_PERIOD,4),Right(TO_PERIOD,2),0),'YYYYMMDD')


Hope this helps!

View solution in original post

5 Replies
jerem1234
Specialist II
Specialist II

Try:

If("TO_SHOP_NO" <= 299,'SEK',
If(("TO_SHOP_NO" >= 400 and "TO_SHOP_NO" <= 499) or ("TO_SHOP_NO" >= 610 and "TO_SHOP_NO" <= 699),'EUR',
If("TO_SHOP_NO" >= 600 and "TO_SHOP_NO" <= 609,'EEK')))
&
Date(MakeWeekDate(Left(TO_PERIOD,4),Right(TO_PERIOD,2),0),'YYYYMMDD')


Hope this helps!

johnca
Specialist
Specialist

Hi Brad,

Question: What about values that fall out of those specific ranges?

--john

marcus_sommer

I assume that expression-matching isn't the only one from this kind in your apps and you will need it so or with slight changes quite often. Then it's better to create a extra field for this as matching-table or joined to the TO_SHOP_NO - you will need only one or two minutes in excel to create such a table.

- Marcus

Not applicable
Author

you are right Marcus!

thank you for the great advice.

Not applicable
Author

Hi John!

good question.

i am only looking at matching those specific values, the outliers are categorized as other sales channels , however for this purpose we are focused on the store channel.

Best

Brad