Group by using Azure ML

22176499 20 Reputation points
2023-06-23T09:36:07.4833333+00:00

Hello,

I have a dataset with a column "date", and i want to do a group by "month".
How can i do it ?

thanks

Azure Machine Learning
0 comments No comments
{count} votes

Answer accepted by question author
  1. YutongTie-9091 54,016 Reputation points Moderator
    2023-06-24T04:36:30.45+00:00

    Hello @22176499

    Thanks for reaching out to us, you can use Apply SQL Transformation module and leverage SQL to do it.

    User's image

    As above screenshot, you can add a Apply SQL Transformation module. One way to group by month is leveraging below scheme -

    SELECT  Closing_Date = DATEADD(MONTH, DATEDIFF(MONTH, 0, Closing_Date), 0), 
            Category,  
            COUNT(Status) TotalCount 
    FROM    MyTable
    WHERE   Closing_Date >= '2012-02-01' 
    AND     Closing_Date <= '2012-12-31'
    AND     Defect_Status1 IS NOT NULL
    GROUP BY DATEADD(MONTH, DATEDIFF(MONTH, 0, Closing_Date), 0), Category;
    
    
    

    I refer to the thread here - https://stackoverflow.com/questions/14565788/how-to-group-by-month-from-date-field-using-sql

    Please take a look and do it according to your data format, I hope this helps.

    Regards, Yutong -Please kindly accept the answer if you feel helpful to support the community, thanks a lot.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.