Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to make a field based on a condition

Hi I have a dashboard whose datamodel has just one fact table where all the fields are located..I want to create a field named [displayregionflag] which will store a value 'Y' when the following condition is true

WHERE REGION_NAME IN ('AMS', 'EMEA', 'APJ')

and 'N' when not true

is this possible? if yes how?

if yes do I need to create a new script tab and write the code and concatenate it or something with the fact table?

In the end I would like to have the following result in a tablebox

Region_Name  displayregionflag

ams                    Y

emea                   Y

apj                       Y

others                   N

1 Solution

Accepted Solutions
aveeeeeee7en
Specialist III
Specialist III

Hi

It's better to create a field in the script (Back end). Like this:

if(Match(REGION_NAME,'AMS', 'EMEA', 'APJ'),'Y','N') AS [displayregionflag]

You don't need to create a new tab for this.

Just write this the code in the same table from where you are using REGION_NAME field.

or you can also, do this in front end:

Use calculated dimension:

if(Match(REGION_NAME,'AMS', 'EMEA', 'APJ'),'Y','N')

Regards

Aviral Nag

View solution in original post

2 Replies
aveeeeeee7en
Specialist III
Specialist III

Hi

It's better to create a field in the script (Back end). Like this:

if(Match(REGION_NAME,'AMS', 'EMEA', 'APJ'),'Y','N') AS [displayregionflag]

You don't need to create a new tab for this.

Just write this the code in the same table from where you are using REGION_NAME field.

or you can also, do this in front end:

Use calculated dimension:

if(Match(REGION_NAME,'AMS', 'EMEA', 'APJ'),'Y','N')

Regards

Aviral Nag

Not applicable
Author

This was exactly what I needed thank you