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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Best way to create an If statement

I am brand new to Qlik.

I have a report that reflects Expenditure Types, budgets, actuals, etc.  However, the report I need to provide my supervisor has 16 categories and every expenditure type falls in one of those 16 categories.

Example:

     Expenditure Type is FB, Wage Emp in a new column I want it to fall under my category FB.

Under Expressions I have created a Label of Category and have tried the following scripts. 

      IF([Expenditure Type]=FB Wage Emp,FB,)   

      IF([Expenditure Type]=FB Wage Emp,FB,'')

8 Replies
vishsaggi
Champion III
Champion III

May be like this?

= IF(match([Expenditure Type], 'FB', 'Wage', 'Emp'), 'FB')

Anil_Babu_Samineni

I  am  not sure, I understand your concern.  but,  for ref it's typo error.

Try this

Replace(IF([Expenditure Type]='FB Wage Emp','FB'),'')

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
ramasaisaksoft

Hi Tara,

check like this


IF([Expenditure Type]='FB' or [Expenditure Type]='Wage Emp',FB,[Expenditure Type])

Not applicable
Author

Thank you, this worked perfectly.

Not applicable
Author

Thank you for the assistance. I was finally able to make it work.

Not applicable
Author

Thank you for the assistance. I was finally able to make it work.

jhamard
Partner - Contributor III
Partner - Contributor III

Hi,

For what you expect IF is bullshit.

Simply LOAD a mapping table in your script and add the new field (Expenditure Type Aggr) in your chart.

LOAD * INLINE [

  Expenditure Type, Expenditure Type Aggr

  FB, FB

  Wage Emp, FB

];

rupamjyotidas
Specialist
Specialist

Can you close the thread. If its working now