Hi Guys -
Can someone please help me how I could create the Flag column using multi row formula tool which will flag records as 1 until Hard value and then flags 0 for rest of the records. I have provided expected output for reference. Along with solution if you could share the article of multi row functionality would be great for future requirement.
Input:-
| Sector |
| Total |
| EMG |
| Dev |
| CASH |
| Dev |
| Corp HY |
| EMG |
| Corp IG |
| EMG |
| Hard |
| DurationDeriv |
| Dev |
| Other |
| EMG |
| OtherEM |
| EMG |
| Sovereign Dev |
| EMG |
| Dev |
| Sovereign EM |
| EMG |
Expected Output :-
| Sector | Flag |
| Total | 1 |
| EMG | 1 |
| Dev | 1 |
| CASH | 1 |
| Dev | 1 |
| Corp HY | 1 |
| EMG | 1 |
| Corp IG | 1 |
| EMG | 1 |
| Hard | 1 |
| DurationDeriv | 0 |
| Dev | 0 |
| Other | 0 |
| EMG | 0 |
| OtherEM | 0 |
| EMG | 0 |
| Sovereign Dev | 0 |
| EMG | 0 |
| Dev | 0 |
| Sovereign EM | 0 |
| EMG | 0 |
Solved! Go to Solution.
@anonymous008_G one way of doing this
@binu_acs - thanks for this, Could you please explain how this formula works? Having said that, how commanded Alteryx to read and flag the data?
First Condition: isNull([Row-1:Sector])
What it checks:
It tests whether the field [Row-1:Sector] is null (i.e., missing or undefined) in the previous row.
Result:
If true: The formula returns 1.
This might be used as a starting condition, for example, when processing the first row (where there is no previous row) or when the previous row's Sector is missing.
If false: It moves on to the next condition.
Second Condition: [Row-1:Sector] = 'Hard'
What it checks:
It tests if the previous row's Sector is exactly equal to the text "Hard".
Result:
If true: The formula returns 0.
If false: It continues to the next nested IIF.
Third Condition: [Row-1:Sector] <> 'Hard' and [Row-1:Flag] = 1
What it checks:
Here, two conditions are evaluated:
The previous row's Sector is not equal to "Hard" (i.e., it is something else).
The previous row's Flag is equal to 1.
Result:
If both conditions are true: The formula returns 1.
If not (i.e., either the Sector is "Hard" or the Flag is not 1): The formula returns 0.
@binu_acs Great thanks for the explaination. It would help in future
