Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
its_anandrjs

Month Year Selection

Hi All,

I have a list of Month Year value in this format Jan-11 and it contains data from 2009 to 2011 but i want to select only Jan-11 to May-11.

Please tell me haw can i select that.

Anand

Regards

7 Replies
Not applicable

¿?

for example:

sum/count({$ <year(monthyear)={2011}>}

Can you explain more about the question?

spsrk_84
Creator III
Creator III

Hi,

Can you explain your actual requirement bit more ?

Regards,

Shiva

Not applicable

Hi,
You can always try e.g. Sum(If(YearName(MonthYear)=2011, xxx), or split MonthYear in the script to Month(MonthYear) as Month and Year(MonthYear) as Year...

/@Ungvall

its_anandrjs
Author

I have a Date Column like this

Date Column

2010-06-29 00:00:00

2010-07-02 00:00:00

2010-07-06 00:00:00

2010-07-07 00:00:00

I apply Monthname, MonthYear seprately to get Month and Year value like this

Dec 2010

Jan 2011

Feb 2011

Mar 2011

After that, But i want to select only six months data from the list from the below list 

Jun 2010

Jul 2010

Aug 2010

Sep 2010

Oct 2010

Nov 2010

Dec 2010

Jan 2011

Feb 2011

Mar 2011

Apr 2011

May 2011

Jun 2011

July 2011

Aug 2011

Sep 2011

Like this please provide me the details

Jan 2011

Feb 2011

Mar 2011

Apr 2011

May 2011

Jun 2011

Anand

Not applicable

Hi Anand,

You can use the set analysis to select the range you want.

For Example,

if your expression is  sum(FieldName1)/count(FieldName2)

you can use

sum( {<[Year Month]={">=Jan 2011 <=June 2011"}>} Fieldname1)/

     count({<[Year Month]={">=Jan 2011 <=June 2011"}>}Fieldname2)

where [Year Month] is your Month Year field.

Hope this helps.

Rgds,

Abhinava

sebastiandperei
Specialist
Specialist

Abhinava, are you sure that you can compare dates like this way? The " in Set analisys shows that the comparison is textual or numeric, not dates.

Anardjs, i cant understand if you want to do this in a Graph or in the script. What you mean "I want to select"? Selection are available in List boxes, for example. Anyway, i will give my opinion for both:

1) In a graph:

For example, if you want to see the sales between Jan-2011 and Jun-2011, without take care about time selections.

If you created the MY field from MonthName(Date) function, this field will get both values: numeric date, and text date. You must use $ function to get the numeric value of the data limitation:

Sum({<MonthYearField={">=$(=MakeDate(2011, 01, 1)) <$(=MakeDate(2011, 06, 01))"}>} Sales)

2) In script:

If you want to put a flag on the registers that, in MonthYearField, are in the same interval, try:

Left Join (Dates)

Load

     MonthYearField,

     'Yes'                    as Flag

Resident Dates

Where     MonthYearField >= MakeDate(2011, 01, 01)

     and    Month YearField < MakeDate (2011, 06, 01);

Please, let me know if It was useful for you.

Not applicable

first its best you format the dates   then you could use something like this

Aggr(only({<[Date] ={">=$(=Monthstart(Jan 11,0))<=$(=Monthend(May 11,0))"}>} [Date]),[Date])