Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using an If Statement with a Calculated Dimension

Hello-

I'm trying to use a basic "if" statement in a calculated dimension for a straight table. I want to limit the data shown in the table. I've used an if statement in the past and it has worked correctly, so I'm trying to find reasons why this if statement might not work. I received the "Error in calculated dimension" message.

=if(R Type Desc = 'Sale', R Type Desc)

A few things that may be causing the problem is the spacing within the variable, or the actually value inside the variable? I'm grasping at straws here. I don't think spacing in between a variable name would cause a problem? I didn't create the values inside the variable, but maybe there is an extra space or whatnot and the value of the variable has to be exact? Any thoughts?

Thank you in advance!

Tina

4 Replies
boorgura
Specialist
Specialist

Please try =if([R Type Desc] = 'Sale', [R Type Desc])

Let me know if it works.

Not applicable
Author

That worked! Thank you so much. As I stated, I used the previous IF statement before not using the brackets around the variable. I did notice that my variable's are usually one word, no spaces though. Do you know if this is the reason why it did not work befor using the brackets? Thanks!

boorgura
Specialist
Specialist

yeah, you got it right.

Whenever you have spaces or special characters in a field name, it has to be enclosed by '[ ]'.

johnw
Champion III
Champion III

Or by double quotes, so [Field Name] or "Field Name".