Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
stevietm
Creator
Creator

Last 4 Months

Hi All

I need to calculate prev 4months...im still new at this set analysis and qlikview so pls can some1 jst help me and walk me through the expression...my dimention is month year...What i need to do is get the current month and 4 months back the total of my income for all 4 months together, and then they want me to / that with the outstanding debt on the last day of the last month...Pls can anyone help????

Thanx in advance

Regards Stevie

1 Solution

Accepted Solutions
ecolomer
Master II
Master II

Here you have an example for 3 months

Expression is:

=Sum({<YearMonth ={">=$(=date(addmonths(date#('$(vYearMonth)','MMM-YYYY'),-2),'MMM-YYYY')) <=$(=date#('$(vYearMonth)','MMM-YYYY'))"}, Year=,Month=>} Sales)

View solution in original post

5 Replies
maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

Please send me the sample application i will help u.

stevietm
Creator
Creator
Author

Dont know how never done that before....

avkeep01
Partner - Specialist
Partner - Specialist

Hi Stevie,

You could try this Set Analysis:

Selected month:
=SUM({1<[Month]={$(=MONTH(ADDMONTHS(MAX([Date]),0)))},[Year] ={$(=YEAR(ADDMONTHS(Max([Date]),0)))}>}[LineSalesAmount])

prev. month:
=SUM({1<[Month]={$(=MONTH(ADDMONTHS(MAX([Date]),-1)))},[Year] ={$(=YEAR(ADDMONTHS(Max([Date]),-1)))}>}[LineSalesAmount])

2 months back:
=SUM({1<[Month]={$(=MONTH(ADDMONTHS(MAX([Date]),-2)))},[Year] ={$(=YEAR(ADDMONTHS(Max([Date]),-2)))}>}[LineSalesAmount])

etc.

Regards,

Anton

ecolomer
Master II
Master II

Here you have an example for 3 months

Expression is:

=Sum({<YearMonth ={">=$(=date(addmonths(date#('$(vYearMonth)','MMM-YYYY'),-2),'MMM-YYYY')) <=$(=date#('$(vYearMonth)','MMM-YYYY'))"}, Year=,Month=>} Sales)

stevietm
Creator
Creator
Author

How will i do this for the previous year same months.