Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Calculation On month

Hello All,

I had to convert "DATE_FACTURATION" which is in the format of DD/MM/YYYY  into Monthname and Year (example (14/03/2016 into Mar-2016) and I managed to do it using the below:

month(Date(alt(Date#(DATE_FACTURATION, 'DD/MM/YYYY')), 'DD/MM/YYYY')) & '-' & year(Date(alt(Date#(DATE_FACTURATION, 'DD/MM/YYYY')), 'DD/MM/YYYY')) as Mois_enquete_calcul,

However now I need to use the date "DATE_FACTURATION" to calculate the date minus 6 months and to show in the format of Monthname and Year.

Example:

DATE_FACTURATION     Mois_enquete_calcul

14/03/2016                      Aug-2015

Any idea?

Kind Regards,

Hasvine

1 Solution

Accepted Solutions

Re: Calculation On month

Date(MonthStart(Date#(DATE_FACTURATION, 'DD/MM/YYYY'),-6),'MMM-YYYY')


But perhaps this will work too: Date(MonthStart(DATE_FACTURATION),-6),'MMM-YYYY')


talk is cheap, supply exceeds demand
4 Replies

Re: Calculation On month

Date(MonthStart(Date#(DATE_FACTURATION, 'DD/MM/YYYY'),-6),'MMM-YYYY')


But perhaps this will work too: Date(MonthStart(DATE_FACTURATION),-6),'MMM-YYYY')


talk is cheap, supply exceeds demand

Re: Calculation On month

Hi

Try like this

In script, Convert your date field in date format

For ex:

Load *, Date(Date#(DATE_FACTURATION, 'DD/MM/YYYY'), 'DD/MM/YYYY') AS FACTURATIONDATE

your tablename;

Then in front end,

Date(MonthStart(FACTURATIONDATE,-6),'MMM-YYYY')


hope it helps

Re: Calculation On month

You can also try MonthName() function:

LOAD DATE_FACTURATION

          MonthName(AddMonths(DATE_FACTURATION, -6)) as Mois_enquete_calcul

FROM ...

Not applicable

Re: Calculation On month

It works great.

Thanks,

Hasvine

Community Browser