I have an interesting requirement where in I need to populate between missing months and also get the value of previous month's for the missing month.
Let's say, I have a table like this
And My desired output would have to be like this
Could you please help me how to achieve the same.
@prathipsrinivas One solution:
load Date#('01/'&Month&'/2020','DD/MMM/YYYY') as Month,Amount
load *,if(rowno()=1,Addmonths(Month,1),peek(Month)) as Start resident Input order by Month DESC;
drop table Input;
load Amount, month(monthstart(Month,iterno()-1)) as Month resident Tmp while monthstart(Month,iterno()-1)< Start;
drop table Tmp;
to change inline [Month, AmountJan, 85Mar, 76Oct,90] ;
by From your database..
View solution in original post