Skip to main content
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Simple If/Or question

Hi - I'm new to Qlik Sense but making quite a bit of headway. I've loaded my data and am working on building multiple sheets from this data. The first sheet is going to be a table and charts associated with vehicle accidents. The second sheet will focus on workers compensation claims. The third sheet will be different as well.

I'm having trouble determining which is the best way to set up these sheets. The original data has information for all of these type of events and each event is labeled as a vehicle accident, workers compensation, etc.

Is the best way to set up these sheets for the specific types of claims just to write an expression that filters out everything except for the claims I'm looking for? For example on the vehicle accident sheet, should I just filter out all claims except for the "Auto - BI" and "Auto - PD" cases?

If yes, then I need help on writing an expression. I wrote =if([TYPE]='Auto - BI',[TYPE]) and this worked, but I need to include an "OR" statement to include Auto - PD too. I'm having trouble writing this expression and I'm not seeing much online about how to write a simple OR expression to include both Auto - BI and Auto - PD while filtering out any other types of claims.

Any help would be appreciated.



2 Replies

Hi @Trey,


you have many possibilities that could solve your needs. One of them, and I think it could be the fastest to implement, would be to create the type field that you mention, and add an action inside each sheet that allows you to filter the type of data you need just when you open the sheet.

Another option that occurs to me right now is that you use analysis set for your calculations according to the sheet: Type = {'Accident'}, for example.



Partner Ambassador/MVP
Partner Ambassador/MVP

Generally, you want to use a Set Analysis expression instead of If() for this scenario.  For example, if you wanted a table chart of claim counts by Type.

Dimension:  Type

Count({<[TYPE]={'Auto -BI', 'Auto-PD'}>}ClaimId)

You can simplify this by creating a new field "ClaimClass" in your data model, that has the values "Auto" "Worker", etc.  Then, instead of listing all the Auto types you can use:


In your load script, you create the ClaimClass field by using a Mapping table that maps the various TYPE values into a ClaimClass.

Again, the recommendation is to use set analysis. But if you needed/wanted to use if(), the syntax for OR is:

=if([TYPE]='Auto - BI' or [TYPE]='Auto - PD',[TYPE]) 

Although the better way to test for multiple values is Match().

=if(Match([TYPE], 'Auto - BI',  'Auto - PD'),[TYPE])