Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
jason_nicholas
Creator II
Creator II

load new field when one of multiple conditions exists

I have a data set which loads a list of [Room Name] and the [Building] they are located in. Some of those [Room Names] exist in a separate document I manage listing [Event Spaces]. When a [Room Name] from my data set matches one existing in [Event Spaces], I have it return the value "Event Space" in a new [Room Type] field.

Reference_Sheet:

LOAD [Event Spaces]

           [External Spaces]

from doc.xls;

Data_Sheet1:

LOAD [Room Code]

           Building

           [Other Data]

if(exists([Event Spaces],[Room Code]),'Event Space') as [Room Type]

from data.xls;

// This is repeated for Data_Sheet2, Data_Sheet3, and Data_Sheet4

However, there are some [Room Code] that do not appear on my [Event Spaces] list. They would be designated by the [Building] name "External NA", "External EMEA", or "External APAC". How can I change my code to capture those as 'Event Space' on [Room Type] as well?

I tried:

if(exists([Event Spaces], [Room Code] or Building),'Event Space') as [Room Type]

//for this one, I added the three possible building names to the [Event Spaces] list

if(exists([Event Spaces], [Room Code])

or

exists([External Spaces], Building),'Event Space') as [Room Type]

Neither one allowed the "External NA", "External EMEA", or "External APAC" to resolve to "Event Space" along with the [Room Code] entries.

Thanks in advance for the help!

2 Replies
swuehl
MVP
MVP

Maybe like

if(   Exists([Event Spaces], [Room Code])

  or Match(Building,'External NA', 'External EMEA', 'External APAC' )

     ,'Event Space') as [Room Type]

jason_nicholas
Creator II
Creator II
Author

That worked perfectly, and elegantly. Just what I needed. Thank you.