Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
chinnu123
Creator
Creator

Hi, I have 12 months data in qlik if i select May month it must dispaly feb,march,april data along with May month data in the same way for every month if i select any month i need to get before three months data along with that...

Please any one help to resolve this issue

8 Replies
krishna_2644
Specialist III
Specialist III

provide some sample data.

ramoncova06
Specialist III
Specialist III

the assumption is that you are going 3 months after the selected date, is this right ?


count({< Date = {"<=$(=ADDMONTHS(MAX(Date),-3))<=$(=MAX(Date))"}>}Value)

chinnu123
Creator
Creator
Author

Thanks for reply Ramon

But we would be selecting only month(not the date) and we would like to have 3months data prior to  the selected month.

ramoncova06
Specialist III
Specialist III

what is your date format ? or I should Rather say what is you Month Format

what if you select Jan ?

the selection of the month should work with the date as long as both fields are related

chinnu123
Creator
Creator
Author

hi ramon,

we don't have any date format in our data.

If we select jan2015 then we should get october2014, november2014, december2014 and jan2015 data

and if it is feb2015 then the data should be november2014,december2014,jan2015 and feb2015 data.

Regards,

Chinnu

vlad_komarov
Partner - Specialist III
Partner - Specialist III

Chinnu,

Is your "Month" field (Jan-2015, Dec-2014, etc) numeric? If so, you can easily use the SetAnalysis sample Ramon has suggested. If not, then you have to convert it (or create a new field) with date(XXXXXX, 'MMM/YYYY') format and use  <= and >= options to specify your months range.

Regards,

VK

ramoncova06
Specialist III
Specialist III

the best thing to do is to create your month field to a date or integer format since at the moment I am assuming it is string

,one option is to use date#(month,'MMMYYYY') as month in your script once you do that you could use the following code

count({< Month= {"<=$(=ADDMONTHS(MAX(Month),-3))<=$(=MAX(Month))"}>}Value)




maxgro
MVP
MVP

iif you have a calendar with month (m) and date field (d)

=Sum({<m=,d={"<=$(=monthend(max(d)))>=$(=date(addmonths(monthstart(max(d)),-3)))"}>}v)

1.png