on 05-03-2016 7:30 PM
Hello
I am trying to derive QTD from CURRENT_DATE. But the result is coming as "2016-Q2'
I just need '2'.
Eg of the Code: select QUARTER(current_date) from DUMMY
I am using below code to get the Quarter from M_TIME_DIMENSION. I extended this Table with YTD, MTD, QTD, QTD, CY, PY.
"QTD" = case when Quarter(current_date) >= "DATE_SAP"
then 'Y'
else 'N'
end.
I am referring to Justin's Blog
would appreciate any insight.
Thanks
Kalyan
if you are only interested in 1,2,3,4 from 2016-Q1,2016-Q2,2016-Q3,2016-Q4. just pass it through RIGHT function, you will get. If you are tring this in Procedure, this is the best approach.
select RIGHT(QUARTER(current_date),1) from DUMMY;
OUTPUT : 2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Why don't you use the QUARTER column from M_TIME_DIMENSION?
Regards,
Krishna Tangudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
73 | |
26 | |
10 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.