# Qlik Education Discussions

Discussion Board for collaboration related to Qlik Education.

Contributor III

Hi,

I have a field Month in my source data. My task is to generate a new feld named Quarter based on the Month field.

- for values Jan, Feb, Mar generate value Q1 in the Quarter field

- for values Apr, May, Jun generate value Q2 in the Quarter field

- for values Jul, Aug, Sep generate value Q3 in the Quarter field

- for values Oct, Nov, Dec generate value Q4 in the Quarter field

Which operators should I use to implement it?

Larisa

1 Solution

Accepted Solutions
MVP & Luminary

See attached example.

talk is cheap, supply exceeds demand
3 Replies
MVP & Luminary

See attached example.

talk is cheap, supply exceeds demand
MVP & Luminary

Hi Larisa,

First, you need to convert the Month field from alphanumeric string to a number. You can do it in a number of ways. One of them is this:

Match(Month, 'Jan', 'Feb', 'Mar', ..., 'Dec')

Then, use this commonly used calculation of the Quarter:

'Q' & ceil(MonthNumber/3) as Quarter.

cheers,

Oleg Troyansky

www.masterssummit.com - take you QlikView skills to the next level!

Employee