Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have one composite key of year and month having values like 201112, 201111,201203..
I want to calculate monthname from this values. How can i get that?
Hi,
Check this code,
LOAD * INLINE [
F1
201304
201405
201212
];
Load Date#(month(date#(right(F1,2),'MM'))&'-'&Year(date#(left(F1,4),'YYYY')),'MMM-YYYY') as month
Resident
test;
it gives me data like
Dec-2012
Apr-2013
May-2014
If still facing issues, attach some sample.
HTH
-Shruti
'right(composite key,2) as Month' will give you the last 2 digits of your key, and recode it as month.
Use
Date(Date#(CompositeKey&'01', 'YYYYMMDD'), 'MMMM')
for the full month name.
Peter
Edit: Sorry, correct now
Hi,
You can try this,
Date#(month(date#(right('201203',2),'MM'))&'-'&Year(date#(left('201203',4),'YYYY')),'MMM-YYYY')
HTH
-Shruti
Month(Fiedl) as Month
and if you want to display the Year also then
Month(Field)&'-'&lEFT(Field,4) as DATE_YEAR
Shruti,
When i pass yearmonth that is my fieldname instead of 201203 this expression is not working
Hi,
When using field no qoutes required.
As per my knowledge this works on field too.
I will check on dummy field and get back.
-shruti
If you put = right(yearmonth,2) in your dimension of the chart (first add yearmonth, and then click 'edit', and you enter the expression, then the chart will show you the months.
Hi,
Check this code,
LOAD * INLINE [
F1
201304
201405
201212
];
Load Date#(month(date#(right(F1,2),'MM'))&'-'&Year(date#(left(F1,4),'YYYY')),'MMM-YYYY') as month
Resident
test;
it gives me data like
Dec-2012
Apr-2013
May-2014
If still facing issues, attach some sample.
HTH
-Shruti