Alteryx Designer Desktop Discussions

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

Multi-Row Formula Query

DHB
8 - Asteroid

I have some data that includes the first  4 columns in the table below and would like to generate the fifth column using a Multi-Row Formula;

 

Activity NumberTile_NumTile_SequenceNumDayActivity Number per Tile
111Monday1
212Tuesday2
313Wednesday3
414Thursday4
515Friday5
 16Saturday 
 17Sunday 
621Monday1
722Tuesday2
823Wednesday3
924Thursday4
1025Friday5
 26Saturday 
 27Sunday 


Basically the formula would count  the number of non-null  'Activity Number(s)'  per Tile. 

 

I've been unsuccessful so far and if anyone could offer some advice I'd be very grateful.

 

Thank you in advance for your help.

 

DHB.

5 REPLIES 5
BenMoss
ACE Emeritus
ACE Emeritus

To me it looks like you are simply looking bring through the tile_sequencenum when the activity number is not blank as the values are exactly the same. If not can you post some more realistic sample data to the problem you face.

If the answer is yes then you can simply use a standard formula tool with the syntax 

 

if [Activity Number] = "" then "" else [Tile_SequenceNum] endif

If you want something like a 'grouped by' record ID you can use the following syntax within the Multi-Row Formula tool.

 

if [Activity Number] = "" then "" else [Row-1: New Field] +1 endif


Ensuring you have grouped by the 'Tile_Num' field and your data is sorted so the blank values in the activity number which we don't want a value to appear in would be at the bottom of the list when it is streamed into the Multi-Row formula tool.

Example attached.


Ben

DHB
8 - Asteroid

Thanks so much Ben,

 

I had locked in myself in to using the Multi-Row Formula tool but your reply made me realise there was a simpler way.  I ended up using a simple formula creating a new column called Tile_Activity_Count;

 

Tile_Activity_Count = if isnull([Activity Number]) then Null() else [Tile_SequenceNum] endif

DHB
8 - Asteroid

I just realised that this doesn't quite work because the sample data that I gave before didn't have any activity within a tile following a null in the same tile.  This complexity is creating a bit of a problem.

 

I'd like to create the fourth column, 'Tile_Activity_Count'.

 

Activity NumberTile_NumTile_SequenceNumTile_Activity_Count
1111
2122
3133
4144
5155
 16 
 17 
6211
7222
8233
9244
10255
 26 
 27 
11311
12322
13333
14344
15355
16366
 37 
17411
18422
19433
20444
 45 
21465
 47 
22511
 52 
23532
24543
25554
26565
 57 

 

I run into problems at Tile 4 Tile_SequenceNum 6 which which occurs after a null Activity_Number at Tile 4 Tile_SequenceNum 5.  My formula gives a 6 (the Tile_SequenceNum) but it needs to be a 5 i.e. the 5th activity within the tile.

 

Does anyone have any suggestions?

DHB
8 - Asteroid

I've managed to solve it by filtering out all the non-null Activity_Number rows and using Ben's Multi-Row tool (formula below) just on those before Unioning the Null rows back in and sorting them back into the right order.

 

if !isnull([Activity Number]) then [Row-1:Activity Number per Tile]+1 else Null() endif

alyon
10 - Fireball

Hi There! I would like that if there are 4 Values for the same record ID or project that are 0, then anything after should be 0 as well. Any idea on how I can accomplish this? I’ve been trying to setup the multi-row formula for this but I keep getting errors on my formula syntax. (See attachment)

 

 

Labels