Alteryx Designer Cloud Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Cloud.
SOLVED

I'm migrating SQL stored procedures to Trifacta. I need to do a sql - select distinct. The only thing I can think of is merge, remove duplicates, split. Is there a better way?

TrifactaUsers
10 - Fireball
 
1 REPLY 1
Trifacta_Alumni
Alteryx Alumni (Retired)

Hi, you perhaps use a window function ROWNUMBER(). Here are the steps:

  • Search Transformation for Rownumber function
  • Put fields that needs to distinct on Group by field
  • Since this is a window function, Sort By is necessary. You could use $sourcerownumber in Sort By
  • Name the column, ex: rownum. Add Step
  • On rownum column dropdown, Select Filter rows, On column values, Is exactly, Value : 1

This will only keep distinct rows and distinct column values based on fields selected in Group By. You can tweak the approach and use ROWNUMBER and Filter in different ways.

 

Best

Vardan