community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Upgrade Alteryx Designer in 10 Steps

Debating whether or not to upgrade to the latest version of Alteryx Designer?

LEARN MORE
Alteryx Gallery is experiencing a problem in which system emails are not being sent out. As a result, if you are attempting to sign up for a new account, you may be unable to verify your email address. We are working to solve this as soon as possible and will remove this notice once resolved.
SOLVED

How to do groupby with having clause in Alteryx

Asteroid

I'm trying to build a workflow which would do the below operation in Alteryx? Should I use In-Db or any other tool like summarize tool to do group by and having. I was able to do the group by using summarize tool, but not able to perform having.  

 

select memberId, procedureCode
from claims
group by memberId, procedureCode
having count(distinct year(ServiceDate) * 100 + month(ServiceDate)) > 4;
Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @monish_chandra 

 

I recommend you to break up your SQL statement in parts.


First, create a field using Formula Tool to do this:

year(ServiceDate) * 100 + month(ServiceDate)

then, use Summarize Tool to Group By (Member Code, Procedure Code) and Count your Formula Field previously created.

 

Then, after all, filter your Count (Formula Field) > 4.

 

You should have your final result.

 

Cheers,

Labels