# New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Valued Contributor II

## 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

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

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
MVP

## Re: Equality in 'If' statement

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)

3 Replies
MVP

## Re: Equality in 'If' statement

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)

Valued Contributor II

## Re: Equality in 'If' statement

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

MVP

## Re: Equality in 'If' statement

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