Community Trekker

Joined:

Apr 1, 2015

## If Statement with Lag Function

Hello all,

I am trying to utilize the If statement and a Lag function, but I can't seem to get the coding right.

As it appears right now I have:

If(:DF == 2, :SS / : DF)

and

If(:DF == 7, :SS / : DF)

I want to utilize both formulas in the same column and I was told the Lag function can help. However, I am unsure as to where this needs to be placed in the script and how to properly insert it.

I had to put a space between : and D because it kept making it an emoji in the chat box and I'm unsure as to how to stop that.

Can anyone help?

3 REPLIES

Super User

Joined:

Jun 23, 2011

## Re: If Statement with Lag Function

hi,

i am not sure where the lag function is supposed to come in.

if you want to put both conditions as one function try this:

If(:DF == 2 | :DF == 7, :SS / :DF, Empty())

alternatively, you can write this using the Match function:

Mathc(:DF, 2, 7, :SS / :DF, Empty())

if this doesn't help please give more details,

ron

Community Trekker

Joined:

Apr 1, 2015

## Re: If Statement with Lag Function

That actually answered what I was looking for, but has raised a new question, which clarifies the use of the lag function I believe.

Trying to now take the value associated with DF == 2 and divide it by the value associated with DF == 7.

Super User

Joined:

Jun 23, 2011

## Re: If Statement with Lag Function

the question is not clear. can you please give an example with a table?