Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to get amount in last 6 months and last 18 months

i am stuck here for calculating data

From last 24 months have to check data with first 6 months and

for last 6 months based on a date column in format(YYYYMMDD) to first 18 months.

Can you anyone please suggest.

51 Replies
YoussefBelloum
Champion
Champion

Trust me, everything is in front of you..

Please can anyone can help me here ? Maybe I'm missing something

Anyone to download the app and test it please ?

Anonymous
Not applicable
Author

in app where you have added expressions for 6 and 18 months data. have only below code even at data loader

SET ThousandSep=' ';

SET DecimalSep=',';

SET MoneyThousandSep=' ';

SET MoneyDecimalSep=',';

SET MoneyFormat='# ##0,00 €;-# ##0,00 €';

SET TimeFormat='hh:mm:ss';

SET DateFormat='DD/MM/YYYY';

SET TimestampFormat='DD/MM/YYYY hh:mm:ss[.fff]';

SET FirstWeekDay=0;

SET BrokenWeeks=1;

SET ReferenceDay=0;

SET FirstMonthOfYear=1;

SET CollationLocale='fr-FR';

SET MonthNames='janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc.';

SET LongMonthNames='janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre';

SET DayNames='lun.;mar.;mer.;jeu.;ven.;sam.;dim.';

SET LongDayNames='lundi;mardi;mercredi;jeudi;vendredi;samedi;dimanche';

last_n_months:

LOAD * Inline [

date,data

20160301,100

20160401,100

20160501,100

20160601,100

20160701,400

20160801,500

20160901,100

20161001,100

20161101,100

20161201,100

20170101,400

20170201,500

20170301,100

20170401,100

20170501,100

20170601,100

20170701,400

20170801,500

20170901,100

20171001,100

20171101,100

20171201,100

20180101,400

20180201,500

];

imrasyed
Partner - Creator II
Partner - Creator II

These are the expressions i am able to see from the app sent by yousseff.

For 6 months:

sum( {< date={">$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-6),'YYYYMMDD'))<=$(=Date(Date#(Max(date),'YYYYMMDD'),'YYYYMMDD'))" }>} data) 

for 18 months:

sum( {< date={">$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-18),'YYYYMMDD'))<=$(=Date(Date#(Max(date),'YYYYMMDD'),'YYYYMMDD'))" }>} data)

I think this is the one you are looking for.

Anonymous
Not applicable
Author

here for 18 months , using this we will be brininging out last 18 months, but we need t get first 18 months in last 24 months

YoussefBelloum
Champion
Champion

so here is what you're looking for:

sum( {< date={">$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-24),'YYYYMMDD'))<=$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-9),'YYYYMMDD'))" }>} data)

YoussefBelloum
Champion
Champion

Sorry, take this one (for first 18 months on the last 24 months)


sum( {< date={">$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-24),'YYYYMMDD'))<=$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-6),'YYYYMMDD'))" }>} data)

Anonymous
Not applicable
Author

this worked for 18 months

can you give me the expression for last 6 months also please.

When i used expression which provided above seems to be having some issue

YoussefBelloum
Champion
Champion

Please precise one last time:

you want LAST 6 months of the last 24 months

or

you want FIRST 6 months of the last 24 months


?

Anonymous
Not applicable
Author

Last 6 months


if date have today's data as latest, we need to get 6 months from today to back

YoussefBelloum
Champion
Champion

for this one, I give you the same I gave you above:

sum( {< date={">=$(=Date(AddMonths(Date#(Max(date),'YYYYMMDD'),-6),'YYYYMMDD'))<=$(=Date(Date#(Max(date),'YYYYMMDD'),'YYYYMMDD'))" }>} data)