Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I m using the the below coding, but its not considering to take the value for the LATEST_MONTH FIELD
load
date(DATE,'YYYY') as YEAR,
date(DATE,'MMM') as MONTH,
if(date(DATE,'YYYY')=Year(Today()),date(DATE,'MM')) as LATEST_MONTH
FROM XXX table
Hi Manioranjan,
Try,
Load
Date(DATE,'YYYY') as YEAR,
Date(DATE,'MMM') as MONTH,
If(Year(DATE)=Year(Today()),date(DATE,'MM')) as LATEST_MONTH
FROM XXX table
Hi Manioranjan,
Try,
Load
Date(DATE,'YYYY') as YEAR,
Date(DATE,'MMM') as MONTH,
If(Year(DATE)=Year(Today()),date(DATE,'MM')) as LATEST_MONTH
FROM XXX table
thnaks got it but , now wht i need is example
if
2015 have from jan to dec
2016 have from jan to may
they need latest 14 months
so they need as
2016 from jan to may and also they need aug, sep, oct, nov, dec from 2015
so they need latest 14 months?
Addmonths() can help you for the last 14 months data
Fine. try like below.
Load
Date(DATE,'YYYY') as YEAR,
Date(DATE,'MMM') as MONTH,
If(DATE >= Monthstart(Addmonths(Today(),-14)),Date(DATE,'MM')) as LAST_14_MONTH,
FROM XXX table;