Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
NavinReddy
Creator II
Creator II

Count Month

Hi All,

I want to count all previous three year months

01-03-2011 from to till date how many months please help me

Thanks in Advance

Niranjan

1 Solution

Accepted Solutions
tresesco
MVP
MVP

See the attached sample for a way in the front end without any data from back end.

edit: My sample takes year as input, you can modify accordingly for date input.

View solution in original post

12 Replies
vikasmahajan

Please Find attached QVW will help you lots.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
er_mohit
Master II
Master II

Try this

=count({<Date={'>=$(=Monthstart(Max(Date),-2))<=$(=Date(Max(Date)))'},Month=>}ID)

MK_QSL
MVP
MVP

Please check enclosed file..

alexandros17
Partner - Champion III
Partner - Champion III

Create 6 variables:

yearLess2start = Makedate(year(today())-2, month(today()), 1);

yearLess2end = Makedate(year(today())-2, month(today()), day(today());

yearLess1start = Makedate(year(today())-1, month(today()), 1);

yearLess1end = Makedate(year(today())-2, month(today()), day(today());

yearCurrentstart = Makedate(year(today()), month(today()), 1);

yearCurrentend = Makedate(year(today()), month(today()), day(today());

Then your expressions must be:

for the 2012: sum({$ <mydate = {'>=$(yearLess2start)<=$(yearLess2end)'}>} value)

for the 2013: sum({$ <mydate = {'>=$(yearLess1start)<=$(yearLess1end)'}>} value)

for the 2014: sum({$ <mydate = {'>=$(yearCurrentstart)<=$(yeaCurrentend)'}>} value)

Hope it helps

NavinReddy
Creator II
Creator II
Author

Hi manish,

Is it possible to get with to dates 01-03-2011 to 12-03-2014

In between using set analysis with out writing any script

Best Regards,

Niranjan

jagan
Partner - Champion III
Partner - Champion III

Hi Niranjan,

Check this thread hope it helps you.

Calculating Months difference between two dates

Regards,

Jagan.

beeaj2011
Contributor III
Contributor III

Hi Niru

I always define a continues month number in my script. So if your application starts with 2011 data I calculate the number by :

(Year(Date) - 2011 ) * 12 + Month(date) so it is very simpel to make calculations in your set analysis f.i :

Sum ({< PERIODKEY = {'> $(=$(vcurrYearMonthnum)-24)   <=  $(=$(vcurrYearMonthnum)-12) ' } ,F_PPP = {1,2} , T_PPP={3} >} COUNTER)

vcurrYearMonthnum has been calculated as mentioned above

Good luck

tresesco
MVP
MVP

See the attached sample for a way in the front end without any data from back end.

edit: My sample takes year as input, you can modify accordingly for date input.

NavinReddy
Creator II
Creator II
Author

Hi Tresesco,

Thanks for your replay,

but im using  03-02-2011 format how can give this date

Thanks you so much

Best Regards,

Niranjan