Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
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
Gysbert_Wassenaar

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

View solution in original post

4 Replies
Gysbert_Wassenaar

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
MayilVahanan

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

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
sunny_talwar

You can also try MonthName() function:

LOAD DATE_FACTURATION

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

FROM ...

Not applicable
Author

It works great.

Thanks,

Hasvine