How to create Quarter column using Processors?

Options
aad34210
aad34210 Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 25 Partner

Hi.

I want to create Quarter column using Processors but I can't create it.
I have below date and year/month/day column and I want add Quarter column.
==[Sample data]==

Date year month day Quarter (Expected)
2020/04/01 2020 4 1 1Q
2020/07/01 2020 7 1 2Q
2020/10/01 2020 10 1 3Q
2021/01/01 2021 01 1 4Q ....
==[Sample data]==

Could you please tell me how can I create Quarter column?

Best regards.
Thank you.

Best Answer

  • Tuong-Vi
    Tuong-Vi Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Neuron 2020, Dataiku DSS Adv Designer, Registered, Neuron 2021, Neuron 2022 Posts: 33 Partner
    Answer ✓
    Options

    Hello,

    I'm not sure to understand what "processors" means, but I think you can use in prepare recipie the Formula option with if...then statement to create Quarter column (if 1<month<=4 then "1Q" else if.......x3) with month is an integer ?

Answers

  • aad34210
    aad34210 Partner, Dataiku DSS Core Designer, Dataiku DSS & SQL, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Registered Posts: 25 Partner
    edited July 17
    Options

    Hi @Tuong-Vi
    san

    Thank you for your prompt reply.

    I tried to use IF statement in Formula function from Processors library, and I can successfully create each Quarter value.

    if(date_month>=4 && date_month<=6,"1Q",
    if(date_month>=7 && date_month<=9,"2Q",
    if(date_month>=10 && date_month<=12,"3Q","4Q")))

    Yes. I created date_month as integer.
    Also "processors" means "Processors library".

    Thank you very much for your support!

Setup Info
    Tags
      Help me…