General Discussions

Discuss any topics that are not product-specific here.

SQL Equivalent for Running Total tool in Alteryx

Surya1425
5 - Atom

I have input data and output data after adding Running total tool in the screenshots attached.

 

But When I have done like in Sql using Window function 

 sum("Sales") over(partition by('id1','id2') order by('Sales') as Run_total     .Its output is Sql OutputSql Output
Here you can see ,the Running totals are correct in Alteryx and SQL according to the groupBy/Partition columns . But I need the same order as Alterx in SQL too.Here in Alteryx ,you can see the first row is picked as id1 '7' NULL, But in SQL ,the first row is picked up as NULL NULL because I think its ordering by Partition columns internally.But on Alteryx is it just random order or can we match both the results . I need the Order because ,i have to use MultiRow tool where the config doesnot have any ordering .SO,Please help me
1 REPLY 1
AndrewDMerrill
13 - Pulsar

Based on the images you shared the Alteryx output can match your SQL output by Sorting on id1, id2. With AMP Engine turned on, data is batched to speed up processing, which is done in a deterministic way, but will mess up the sort ordering. Alternatively, you can add a [RecordID] column prior to Running Total and then Sort on [RecordID] afterward.

Labels