Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi friends I have a Field in my source with name Last Update having Source Load Time stamp.
201503
LastUpdate |
201503 |
Here From 'YYYYMM' need to get Year,Month,Quarter
1)Need to get Year from Last Update field and after need to get month in it(here how to use Right or Left(LastUpdate)
2)Need to get Quarter depend on Month field in If else statement
Key is to recognize the incoming data as a date field of the format YYYYMM using the date#() function. Then you can reference that in Year, Month, and quarter functions;
Load
Year(LastUpdate) as Year,
Month(LastUpdate) as Month,
'Q' & ceil( Month(LastUpdate) /3) as Quarter;
Load
date#(LastUpdate,'YYYYMM') as LastUpdate
from <>
for year you can do
Left(LastUpdate, len(LastUpdate)-2)
For Qt try:
If( Right(LastUpdate, Len(LastUpdate)-4) <=3 ,1,
If(Right(LastUpdate, Len(LastUpdate)-4) > 3 and Right(LastUpdate, Len(LastUpdate)-4) <= 6, 2,
if(Right(LastUpdate, Len(LastUpdate)-4) > 6 and Right(LastUpdate, Len(LastUpdate)-4) <= 9, 3, 4)))
Regards
Rahul