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: 
gfisch13
Creator II
Creator II

If..else condition not working

Hi all - I've tried to use the following IF/Else expression but I'm getting an error.  What am I doing wrong?

if([CC_MCC_Desc] = 'Grocery_Stores_and_Supermarkets'), Sum([CC_Item_Cost]), Sum([CC_Tran_Amt])

If the condtion is true I'm taking a Sum of a field, if the condution is false I'm taking a Sum of a different field.

 

Appreciate any comments.  Thanks!

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

You have an extra parenthesis and a missing one at the end

if([CC_MCC_Desc] = 'Grocery_Stores_and_Supermarkets'), Sum([CC_Item_Cost]), Sum([CC_Tran_Amt]))

Try this

If([CC_MCC_Desc] = 'Grocery_Stores_and_Supermarkets',
  Sum([CC_Item_Cost]),
  Sum([CC_Tran_Amt])
)

 

View solution in original post

2 Replies
sunny_talwar

You have an extra parenthesis and a missing one at the end

if([CC_MCC_Desc] = 'Grocery_Stores_and_Supermarkets'), Sum([CC_Item_Cost]), Sum([CC_Tran_Amt]))

Try this

If([CC_MCC_Desc] = 'Grocery_Stores_and_Supermarkets',
  Sum([CC_Item_Cost]),
  Sum([CC_Tran_Amt])
)

 

gfisch13
Creator II
Creator II
Author

Thanks Sunny T!