Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Apply Map

Hi

I have date field.

I extracted the month from this date using Month(Date) as named the field as My_Month.

My_Month will have the values

Jan

Feb

Mar

Apr.

I want this months to get mapped against Quarter.

So i used applymap function.

Month_Quarter_Mapping:

Mapping Load * Inline

[

Jan,Q1

Feb,Q1

Mar,Q1

Apr,Q1

May,Q1

Jun,Q2

];

Note: My requirement is Jan-May Q1.

I used

applymap('Month_Quarter_Mapping',My_Month) as My_Quarter.

My_Quarter is also showing

Jan

Feb

Mar

May.

I wanted it to show

Q1

Q1

Q1

Q1

Q2

instead.

Could anyone help me on this.

Thanks!

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Or replace your month names with numbers in your mapping table:

Month_Quarter_Mapping:

Mapping Load * Inline

[

1,Q1

2,Q1

3,Q1

4,Q1

5,Q1

6,Q2

];

View solution in original post

15 Replies
Anonymous
Not applicable
Author

First you have to name your fields in the inline table.i.e Month,Quarter

Month_Quarter_Mapping:

Mapping Load * Inline

[

My_Month,My_Quarter

Jan,Q1

Feb,Q1

Mar,Q1

Apr,Q1

May,Q1

Jun,Q2

];

fvelascog72
Partner - Specialist
Partner - Specialist

Hi,

You can use:

'Q'&Ceil(Month(Date(YOURDATEFIELD),'DD/MM/YYYY'))/3)          as "Quarter"

jpenuliar
Partner - Specialist III
Partner - Specialist III

'Q' & Ceil(Month(Date)/3) as Quarter  should do the trick

Anonymous
Not applicable
Author

But my requirement is bit different.

Jan-May as Q1

Jun-Jul as Q2

Aug-Sep as Q3

Oct-Dec as Q4

venkatg6759
Creator III
Creator III

try to define ur months in mapping load table

Mapping Load * Inline [

Month,Quarter

Jan ,Q1

Feb,Q1

..........

Jun,Q2

];

then do applymap from this table to ur calender date table

-SW-
Partner - Creator II
Partner - Creator II

Jebamalai is correct, if you use his code, to add the headers,


Month_Quarter_Mapping:

Mapping Load * Inline

[

My_Month,My_Quarter

Jan,Q1

Feb,Q1

Mar,Q1

Apr,Q1

May,Q1

Jun,Q2

];

then use your code in your load statement,


applymap('Month_Quarter_Mapping',My_Month) as My_Quarter.



In front end, your My_Quarter details should display as Q1, etc.

Anonymous
Not applicable
Author

Ya i tried the same but still i am getting the Quarter as Jan,Feb,Mar,Apr,May ,Jun instead of Q1,Q1,Q1,Q1,Q1,Q2.

-SW-
Partner - Creator II
Partner - Creator II

Can you post your sample qvw?

Anonymous
Not applicable
Author

can you send the updated code you are using?