Start Free Trial

Alteryx Designer Desktop Discussions

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

Conditional sorting of a column based on another column -Alteryx Designer

SrinivasanSugumaran
8 - Asteroid

Hi Team

Can i seek ur help in conditional sorting.

Data is grouped based on Area /Category.

Sorting of column Comment 1 should happen basis the column chk.(i.e if chk is summation negative for a area & category then comment 1 should be sorted with decrease; if chk is summation positive for a area & category then comment 1 should be sorted with increase)

Appreciate your time

Thanks.

 

Actual Data:

Area CategoryChkComment 1
BostonCEuSummation Negative 
BostonCEuSummation NegativeDecrease in Sales
BostonCEuSummation NegativeIncrease in Sales
BostonEuSummation Positive 
DallasSSummation Positive 
DallasSCSummation Negative 
DallasSCSummation NegativeDecrease in Sales
DallasSCSummation NegativeIncrease in Sales
NewyorkCRuRSummation Positive 
CaliforniaCSummation Negative 
SingaporeCSummation Positive 
CanadaCSuSummation Positive 
CanadaSuSummation Positive 
WhalesCSummation Positive 
WhalesCSummation PositiveDecrease in Sales
WhalesCSummation PositiveIncrease in Sales

 

Expected result:

Area CategoryChkComment 1
BostonCEuSummation NegativeDecrease in Sales
BostonCEuSummation NegativeIncrease in Sales
BostonCEuSummation Negative 
BostonEuSummation Positive 
DallasSSummation Positive 
DallasSCSummation NegativeDecrease in Sales
DallasSCSummation NegativeIncrease in Sales
DallasSCSummation Negative 
NewyorkCRuRSummation Positive 
CaliforniaCSummation Negative 
SingaporeCSummation Positive 
CanadaCSuSummation Positive 
CanadaSuSummation Positive 
WhalesCSummation PositiveIncrease in Sales
WhalesCSummation PositiveDecrease in Sales
WhalesCSummation Positive 
6 REPLIES 6
flying008
15 - Aurora

Hi, @SrinivasanSugumaran 

 

What's your logic for the blank cell of filed [Comment 1] ?

 

录制_2024_11_28_14_38_44_130.gif

 

AreaCategoryChkComment 1Tile_NumTile_SequenceNumAlpha
BostonCEuSummation NegativeIncrease in Sales1-3A3
BostonCEuSummation NegativeDecrease in Sales1-2A2
BostonCEuSummation Negative 1-1A1
BostonEuSummation Positive 21A1
DallasSSummation Positive 31A1
DallasSCSummation NegativeIncrease in Sales4-3A3
DallasSCSummation NegativeDecrease in Sales4-2A2
DallasSCSummation Negative 4-1A1
NewyorkCRuRSummation Positive 51A1
CaliforniaCSummation Negative 6-1A1
SingaporeCSummation Positive 71A1
CanadaCSuSummation Positive 81A1
CanadaSuSummation Positive 91A1
WhalesCSummation Positive 101A1
WhalesCSummation PositiveDecrease in Sales102A2
WhalesCSummation PositiveIncrease in Sales103A3
SrinivasanSugumaran
8 - Asteroid

Thanks for the reply. Blank should always be at bottom. Can u pls attach the workflow too

Qiu
21 - Polaris
21 - Polaris

@SrinivasanSugumaran 
I made a few assumptions

1. By "summation", meaning that there is case that Positive and Negative are mixed in one Area /Category, and the majority will prevail.

2. The blank row always gos to bottom.

1128-SrinivasanSugumaran.png

SrinivasanSugumaran
8 - Asteroid

HI  

@flying008  - Thanks for the reply. Blank should always be at bottom. Can u pls attach the workflow too
flying008
15 - Aurora

Hi, @SrinivasanSugumaran 

 

What is your real data of the field [Comment 1] ? Number or String ?

 

录制_2024_11_28_16_39_49_840.gif

 

录制_2024_11_28_16_40_47_895.gif

 

IIF([Chk] = 'Summation Negative',  IIF(IsEmpty([Comment 1]), 0, [Tile_SequenceNum]) * -1, IIF(IsEmpty([Comment 1]), [Tile_SequenceNum] + [Max_Tile], [Tile_SequenceNum]))
AreaCategoryChkComment 1
BostonCEuSummation NegativeIncrease in Sales
BostonCEuSummation NegativeDecrease in Sales
BostonCEuSummation Negative 
BostonEuSummation Positive 
DallasSSummation Positive 
DallasSCSummation NegativeIncrease in Sales
DallasSCSummation NegativeDecrease in Sales
DallasSCSummation Negative 
NewyorkCRuRSummation Positive 
CaliforniaCSummation Negative 
SingaporeCSummation Positive 
CanadaCSuSummation Positive 
CanadaSuSummation Positive 
WhalesCSummation PositiveDecrease in Sales
WhalesCSummation PositiveIncrease in Sales
WhalesCSummation Positive 

 

SrinivasanSugumaran
8 - Asteroid

Thanks @Qiu ,@flying008 

Labels
Top Solution Authors