Help

If statement for adding days

1532 2
cancel
Showing results for 
Search instead for 
Did you mean: 
TCRC_CTY
4 - Data Explorer
4 - Data Explorer

I need some help if anyone could be of assistance. I’m trying to do an if statement to add days to a previous date field. I got it to add days already with DATEADD({Date Violated}, 60, ‘DAYS’).

However, there is a small change where I need it to add 30 days in some cases with another field that is a single select. The code I’ve tried so far is as follows.

IF(Violation=‘Discipline’, DATEADD({Date Violated}, 30, ‘DAYS’), DATEADD({Date Violated}, 60, ‘DAYS’)

I get an error, and I’m not entirely sure what I’m doing wrong.

2 Replies 2
TCRC_CTY
4 - Data Explorer
4 - Data Explorer

So, I figured it out. Tried making a simpler statement to see where I was going wrong. Slowly added on to it.
As from what I had seen in most other threads, it’s a lack of parenthesis. I ended up with this.

IF({Violation}=“Discipline”, DATEADD({Date Violated}, 30, ‘DAYS’), DATEADD({Date Violated}, 60, ‘DAYS’))

Yes, that formula misses the closing parentheses of the IF.