cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

WebI: Previous Function with Condition

0 Likes
14,641

Hi All,

I need to perform the following calculation: for each row set to 1 if the current and previous 2 consecutive days have flag = N with the customer as a reset dimension (second column).

In the example it is possible to obtain the result as in the "Value" column?

I tried to use the Previuos Function but always consider the lines with flag = Y

Is it possible to perform this calculation ignoring row with flag = Y?

Thanks to all.

Davide

View Entire Topic
Tom_N8
Contributor
0 Likes

Hi Davide,

Use the Previous() function as follows:

=If((Previous([Flag])="N" And (Previous([Flag];2)="N" And [Flag]="N") And Previous([Customer]) = [Customer])) Then 1 Else 0

This will return Value 1 where your current flag, the previous flag and the previous of that previous flag is equal to 'N':

If you're only looking for a comparison of the current flag with the previous flag, change the above formula to:

=If((Previous([Flag])="N" And [Flag]="N") And Previous([Customer]) = [Customer])) Then 1 Else 0

You can obtain the previous of the previous value by using the offset parameter. In the first formula at the top, this has been set to '2'.

Read more about the Previous() function in the "Using functions, formulas and calculations in Web Intelligence" guide.

Kind regards,

Tom