Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Any idea on how to get the minimum month with respect of minimum year?
[New Table]:
Load
[Min_Year] &'|'& [Min_Month] as [%New_Data]
;
Load
Min([Year]) as [Min_Year],
Min([Month]) as [Min_Month]
I have no problem with the [Min_Year]. My goal to [Min_Month] is to return the min month with respect of min year. The result should be:
[%New_Data] = 2011 | May
The month is already in dual value in mapping.
May be combine the two before you find the Min..
Table:
LOAD ...,
Date#(Month&'|'&Year, 'MMM|YYYY') as MonthYear
FROM ....;
NewTable:
LOAD Date(Min(MonthYear), 'MMM|YYYY') as [%New_Data]
Resident Table;
How is Min Month for Min Year is December? You mean the Max Month for Min Year? Because Min Month for Min Year is January, isn't it?
I have corrected my example above. The return value should be:
2011 | May
May be combine the two before you find the Min..
Table:
LOAD ...,
Date#(Month&'|'&Year, 'MMM|YYYY') as MonthYear
FROM ....;
NewTable:
LOAD Date(Min(MonthYear), 'MMM|YYYY') as [%New_Data]
Resident Table;
May be like below
[New Table]:
Load
[Min_Year] &'|'& [Min_Month] as [%New_Data]
;
Load
Min([Year]) as [Min_Year],
Month(Min(Date#([Year]&[Month],'YYYYMM'))) as [Min_Month]
Resident Table;
But why adding the additional complexity when it can be solved without it?
Not exactly what I need right now. Comment below is my code.
Yeah.. I dont know what I was thinking.. that solution does not make sense sunny!!
Sorry, I am not sure I understand your comment... What exactly are you trying to do? Can you elaborate on your requirement?
Maybe this will help you
t1:
LOAD * INLINE [
Year, Month
2011, May
2013, February
2013, March,
2014, April
2015, January
];
load
Date(Min(Date#(MonthYear,'YYYY|MMMM')),'YYYY|MMMM') as MonthYear;
t2:
load
Year&'|'&Month as MonthYear
Resident t1;
Drop table t1;