Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
JustinDallas
Specialist III
Specialist III

Equality in 'If' statement

Hello Everyone,

I have a straight table with a field named  'exp_id'.    In my data model, I also have two other fields, StatusStartDate, StatusEndDate, and CalDate.  In the straight table, I have this


Expression_!.PNG

But when I go to my straight table, I am greeted with this "Invalid Dimension" error.

Expression_2.PNG

What concept am I missing here?  What I am trying to say is

"Only show the exp_id property if the StatusStartDate comes before the smallest selected CalDate"


Any help is greatly appreciated.

1 Solution

Accepted Solutions
sunny_talwar

For a calculated dimension, you need an Aggr() function or use TOTAL within Min(CalDate)

1) Aggr(If(StatusStartDate < Min(CalDate), exp_id), exp_id)

2) If(StatusStartDate < Min(TOTAL CalDate), exp_id)

View solution in original post

3 Replies
sunny_talwar

For a calculated dimension, you need an Aggr() function or use TOTAL within Min(CalDate)

1) Aggr(If(StatusStartDate < Min(CalDate), exp_id), exp_id)

2) If(StatusStartDate < Min(TOTAL CalDate), exp_id)

JustinDallas
Specialist III
Specialist III
Author

Thanks a bunch for your help Sunny.  Do you mind explaining the science behind why I have to use such functions?

sunny_talwar

When using Aggregation in calculated dimension, you need to specify a dimension, or tell your expression that you are looking for overall Min by using TOTAL. Unless you do that, calculated dimension don't really work. I might not have done a great job explaining it, but may be check this link out on Calculated Dimensions