Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
yipchunyu
Creator
Creator

makedate from 2018Q1

Very simple question, any function to convert 2018Q1, 2018Q2 as the date e.g. YYYY/MM/DD - 2018/1/1, 2018/4/1 ...

3 Replies
tresesco
MVP
MVP

Capture.JPG

This could be one way.

jfkinspari
Partner - Specialist
Partner - Specialist

Sure, number of ways, bot not explicit function to interpret Quarters as in e.g. Q1

Date:
LOAD
 Quarter,
 MakeDate(Left(Quarter, 4), (right(Quarter,1)*3)-2) As Date;
LOAD * Inline [
Quarter
2018Q1
2018Q2
2018Q3
2018Q4
];

lse
Employee
Employee

I'd do it in the load script with something like this:

Load
*,
QuarterStart(MakeDate(SubField(Quarter,'Q', 1), SubField(Quarter,'Q', 2)*3)) as [DateInQ Option 1],
MakeDate(SubField(Quarter, 'Q', 1), SubField(Quarter, 'Q', 2)*3-2) as [DateInQ Option 2];
Load
Upper(Quarter) as Quarter;
Load
*
Inline
[Quarter
2018Q1
2018Q2
2018Q3
2018Q4
2019Q1];