I have a Month column that contains Months value Like this 'January', 'February' and so on. I have a Year field that contains Year Value Like this '2014', '2015' and so on.
I would like to tie this two column and make a date field and then calculate the max date from this field.
The problem is when i concatenate this two field and make one date field i cant calculate max date from that date field. I think the reason behind is, i am concatenating string and number.
Could anyone help me out this problem?
Solved! Go to Solution.
I don't think being a number would stop the concatenation. Works fine for me like this:
date#('February ' & 2015,'MMMM YYYY')
So in the script, I'd do something like this:
,date#([Month] & ' ' & [Year],'MMMM YYYY') as [Month Year]
And then just this as the expression:
edit: date(max([Month Year],'MMM YYYY')
Hi John, Thanks a lot!
While calculating the max i am getting integer value but if i use date function before max then i am getting date format like this 1/1/2016. but i would like to keep it like Jan 2016.
Here is a sample to play around with:
MonthName(Date) as MonthYear;
MakeDate(Year, Num(Month(Date#(Month, 'MMMM'))), 1) as Date;
LOAD * Inline [
Year, Month, Sales
2014, January, 343
2014, February, 420
2014, March, 492
2014, April, 234
2014, May, 542
2014, June, 432
2014, July, 654
2014, August, 234
2014, September, 323
2014, October, 653
2014, November, 653
2014, December, 658
Hi Sunny, for some reason your solution didnt show up before Johns post! . I dont know what happened.
But thank you so much for your help. You have been very helpful before as well.
As long as you get to what you are looking for, we don't mind who get the right answer. If you still feel my answer is useful, you can mark it as a helpful answer (but you don't have to)