Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have data as follows:
loading | month | production cost |
1 | 2 | 3,48 |
2 | 4 | 3,15 |
3 | 8 | 3,25 |
1/19 | 2 | 3,43 |
2/19 | 5 | 3,41 |
I need to convert month to text and add year.
Month values (2,4,8) are Feb 2018, April 2018, August 2018 based on loading column (1, 2, 3).
Month values (2, 5) based on loading column (1/19 i 2/19) are respectively Feb 2019 and May 2019.
Could you assist?
LOAD
monthname( makedate(alt(year(date#(loading, 'M/YY')), 2018) , month)) as YearMonth,
*
inline [
loading,month, production cost
1, 2, 3.48
2, 4, 3.15
3, 8, 3.25
1/19, 2, 3.43
2/19, 5, 3.41];
exit script;
This assumes that you will have year for all loadings except when year = 2018, but then you will be able to get the year month as below.
LOAD
monthname( makedate(alt(year(date#(loading, 'M/YY')), 2018) , month)) as YearMonth,
*
inline [
loading,month, production cost
1, 2, 3.48
2, 4, 3.15
3, 8, 3.25
1/19, 2, 3.43
2/19, 5, 3.41];
exit script;
This assumes that you will have year for all loadings except when year = 2018, but then you will be able to get the year month as below.
How to identify Which month will under Which year, Any other logic to note?