Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Year(DATE) & right(’00′ & week(DATE),2) as YYYYWW,
Year(DATE) & right(’00′ & num(Month(DATE)),2) as YYYYMM,
Year(DATE) & ceil(num(Month(DATE))/3) as YYYYK,
‘Quarter’ & ceil(num(Month(DATE))/3) as QUARTER
Pls explain me i am great full to u
Hi Manojqlik,
The script is combining 2 fields to present a date in the dashboard like YearWeek, YearMonth etc.
To do this you need to combine fields.
Year(DATE) is creating a year from the date field.
right(’00′ & week(DATE),2) is creating a week from the date field but is including 00 as prceding number. So you will get 2014(year)0010(week).
Is that clear?
your script
t:
load
'01/01/2014' + rowno() as DATE
autogenerate 365;
load
DATE,
Year(DATE) & right('00' & week(DATE),2) as YYYYWW,
Year(DATE) & right('00' & num(Month(DATE)),2) as YYYYMM,
Year(DATE) & ceil(num(Month(DATE))/3) as YYYYK,
'Quarter' & ceil(num(Month(DATE))/3) as QUARTER
Resident t
;
and the function used (from online help)
&
String concatenation. The operation returns a text string, that consists of the two operand strings, one after another.
right(s,n)
Substring of the string s. The result is a string consisting of the last n characters of s.
ceil(x [ , base [ , offset ]])
Rounding of x upwards to the nearest multiple of base with an offset of offset. The result is a number
week(date)
Returns an integer representing the week when the fraction of expr is interpreted as a date according to the standard number interpretation
month(date)
Month. Returns a text string representing the month when the fraction of expr is interpreted as a date, but can be formatted as a number.