Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
sujit_nath
Creator III
Creator III

Generate a column that has combination of month and quarter

I have month and column values such as:

QuarterMonth
Q1Jan
Q1Feb
Q1Mar
Q2Apr
Q2May
Q2June
Q3July

 

and so on..

Now I want to add a 3rd column that has values like:

QuarterMonthQMonth
Q1JanJan
Q1FebFeb
Q1MarMar
Q1JanQ1
Q1FebQ1
Q1MarQ1
Q2AprApr
Q2MayMay
Q2JuneJune

 

and so on...

How do I add this third column QMonth.

Thanks!!

Labels (1)
2 Solutions

Accepted Solutions
tresesco
MVP
MVP

Try:

t1:
LOAD Quarter, 
     Month,
     Month as QMonth
FROM
[https://community.qlik.com/t5/QlikView-App-Development/Generate-a-column-that-has-combination-of-month-and-quarter/td-p/1676455]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Load
	Quarter,
	Month,
	'Q'&Ceil(Month(Date#(Month, 'MMM'))/3) as QMonth 
Resident t1;

View solution in original post

Vegar
MVP
MVP

What if you do like this?

Calendar:

Load

*,

Quarter as QMonth

From Calendar;

 

Concatenate Load

*,

Month as QMonth

From Calendar;

View solution in original post

6 Replies
tresesco
MVP
MVP

Try:

t1:
LOAD Quarter, 
     Month,
     Month as QMonth
FROM
[https://community.qlik.com/t5/QlikView-App-Development/Generate-a-column-that-has-combination-of-month-and-quarter/td-p/1676455]
(html, utf8, UserAgent is 'Mozilla/5.0', embedded labels, table is @1);

Load
	Quarter,
	Month,
	'Q'&Ceil(Month(Date#(Month, 'MMM'))/3) as QMonth 
Resident t1;
Vegar
MVP
MVP

What if you do like this?

Calendar:

Load

*,

Quarter as QMonth

From Calendar;

 

Concatenate Load

*,

Month as QMonth

From Calendar;

sujit_nath
Creator III
Creator III
Author

Using both the solutions, the data is like:

QuarterMonthQmonth
Q1OctQ1
Q1NovQ1
Q1NovQ2
Q1DecQ1
Q1DecQ3
Q2JanQ2
Q2JanQ4
Q2FebQ2
Q2FebFeb
Q2MarQ2
Q2MarMar
Q3AprQ3
Q3AprApr
Q3MayQ3
Q3MayMay
Q3JunQ3
Q3JunJun
Q4JulQ4
Q4JulJul
Q4AugQ4
Q4AugAug
Q4SepQ4
Q4SepSep
Vegar
MVP
MVP

I don't see how that result I possible for neither mine or @tresesco  suggested solution. You must be doing something else as well. Please share script and a screenshot of your data model with focus around your calendar.

sujit_nath
Creator III
Creator III
Author

Even my understanding thought of the solution you suggested, seemed quite straight forward solution, but unable to figure what's wrong. Let me check other things here as well. 

sujit_nath
Creator III
Creator III
Author

Got It!! Wrapped Quarter in Text and this worked... Not sure of the issue, but at least I get the solution.

Thanks alot!!