We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Increment Rank using Multi-Row Formula tool when a Value is found again

ssripat3
8 - Asteroid

Hello community,

 

I am trying to create a Rank column using Multi-Row formula tool. I was able to do it, but my data has some changes and my current logic is not able to handle it.

Input Data

 

JSON_NameJSON_ValueString
Code2X12345
Code3AA
NumberABC12345
NameX12345AA
CompanyNameTEST
Code2Y12345
Code3BB
NumberXYZ12345
NameY12345BB
CompanyNameTEST
Code2Z12345
Code3CC
NumberZYX12345
NameZ12345CC
CompanyNameTEST
Code1NAC3AD
Code21234
Code3AA
NumberA90112012
NameNAC3AD1234AA
CompanyNameTEST
Code1NAC3AD
Code24567
Code3BA
NumberB90110312
NameNAC3AD4567BA
CompanyNameTEST

 

Currently, I am using the Multi-Row formula using the formula mentioned below.

 

IF [JSON_Name] = "Code1" then [Row-1:Rank] + 1
ELSE [Row-1:Rank] ENDIF

There are some instances in the data where the Code1 field will not be available with the response from the API like shown in the above example. When I am using this formula, I am getting the below result which is causing me some data loss.

 

JSON_NameJSON_ValueStringRank
Code2X123450
Code3AA0
NumberABC123450
NameX12345AA0
CompanyNameTEST0
Code2Y123450
Code3BB0
NumberXYZ123450
NameY12345BB0
CompanyNameTEST0
Code2Z123450
Code3CC0
NumberZYX123450
NameZ12345CC0
CompanyNameTEST0
Code1NAC3AD1
Code212341
Code3AA1
NumberA901120121
NameNAC3AD1234AA1
CompanyNameTEST1
Code1NAC3AD2
Code245672
Code3BA2
NumberB901103122
NameNAC3AD4567BA2
CompanyNameTEST2

 

Due to instances like these, I would like to use CompanyName as the identifier to increment Rank instead of prefix

 

Expected Output

 

JSON_NameJSON_ValueStringRank
Code2X123450
Code3AA0
NumberABC123450
NameX12345AA0
CompanyNameTEST0
Code2Y123451
Code3BB1
NumberXYZ123451
NameY12345BB1
CompanyNameTEST1
Code2Z123452
Code3CC2
NumberZYX123452
NameZ12345CC2
CompanyNameTEST2
Code1NAC3AD3
Code212343
Code3AA3
NumberA901120123
NameNAC3AD1234AA3
CompanyNameTEST3
Code1NAC3AD4
Code245674
Code3BA4
NumberB901103124
NameNAC3AD4567BA4
CompanyNameTEST4

 

Can someone please help me with this?

Thank you

 

2 REPLIES 2
davidskaife
14 - Magnetar

Hi @ssripat3 

 

If i'm understanding correctly try this formula instead:

 

IF [Row-1:JSON_Name] = "CompanyName" 
THEN [Row-1:Rank] + 1
ELSE [Row-1:Rank] 
ENDIF
ssripat3
8 - Asteroid

@davidskaife. That works as expected, thank you so much.

Labels
Top Solution Authors