cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax for an if statement with calculation contexts

former_member928925
Discoverer
0 Kudos

Hello -

I'm looking for some syntax help.  I don't know how to structure the syntax to give me a new field that will indicate if a student has taken BIO-157 with a passing grade before they took BIO-263.

I was guessing it should be something like this but then of course there is no 'when' clause available.

=IF ([Enrollment Start Date]) When ([Enrolled Course Name] = "BIO-157" and [Passing Grade]="Yes") FOREACH ([Enrolled Academic Credit Id])

< ([Enrollment Start Date] When ([Enrolled Course Name] = "BIO-263") FOREACH ([Enrolled Academic Credit Id])

then "Yes" Else "No"

Thanks for any help possible!

Accepted Solutions (1)

Accepted Solutions (1)

mhmohammed
Active Contributor
0 Kudos

Hi Amy,

Instead of When, you'll have to use Where, but, one thing I've learned working on If statements including Where and Calculation contexts is, try to create few variables for those Where clauses and then use them in the If statement or else, they won't work fine.

Create the below variables:

v_BIO-157_Yes = [Enrollment Start Date] Where ([Enrolled Course Name] = "BIO-157" and [Passing Grade]="Yes")

v_BIO-263 = [Enrollment Start Date] Where ([Enrolled Course Name] = "BIO-263")

And then, create that If statement, try that and let us know what happens.


Thanks,

Mahboob Mohammed

former_member928925
Discoverer
0 Kudos

Thank you!  Yes that worked with a few modifications.

v_BIO-157_Yes = =If ([Enrolled Course Name])="BIO-157" And ([BIO-157 Passing Grade]) = "Yes" Then [Enrollment Start Date]

v_BIO-263 = =If([Enrolled Course Name])="BIO-263" Then [Enrollment Start Date]

And the new indicator was:

BIO-157 First = =If(Max([v_BIO-157_Yes])) < Min([v_BIO-263]) ForEach ([Enrolled Student ID]) Then "Yes" Else "No"

I had to add the minimum selection to BIO-263 because I was getting a multi-value error for students that repeated 263.

Thanks!

mhmohammed
Active Contributor
0 Kudos

Glad! It worked for you.

Thanks,

Mahboob Mohammed

Answers (0)