Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
The #1 reason QlikView customers adopt Qlik Sense is a desire for a modern BI experience. Read More
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Selecting LAST MONTH

i have some data  in my Qlikview

My filters are Years  and Months

2000 to  2015

and months   Jan to  December

Working Nicely:  When i select  year and Month together  for example:     year 2014 and month july   it will give me the data of  july 2014.

My Requirement     if i click  year  2014  or any previous years  (without selecting month)  it should give me the data of  last month (December)

and If i Select  2015  it should give me the  the data of  Last Month ( in my case May is my last Month)

Please write any set analysis code for me plz

thanks

1 Solution

Accepted Solutions
Highlighted
Partner
Partner

Re: Selecting LAST MONTH

Hi Tahir,


Check the Month field. I presume that the Month field has string (ie., Apr, May ....), you can create another filed to identify the month as numeric (i.e, 1,2,3,4,5,6,7,8,9,10,11,12), as Max and min functions does not work on string. Please share a sample app, so that we can have a look.

View solution in original post

12 Replies
Highlighted
Specialist
Specialist

Re: Selecting LAST MONTH

Try this

=Sum({$<Month={$(=Max(Month))}>}Sales)

Highlighted
Partner
Partner

Re: Selecting LAST MONTH

Use below expression:

Sum({<Year={$(=Max(Year))}, Month= {"$(=max({<Year={$(=max(Year))}>} Month))"},Month= >}Sales)

Highlighted
Creator II
Creator II

Re: Selecting LAST MONTH

Both will work fine but Sum({$<Month={$(=Max(Month))}>}Sales) is much easier 🙂

Highlighted
Not applicable

Re: Selecting LAST MONTH

thanks santhosh!

let me clear   we have employees   in our  Department

year 2015

employees:

                         Year 2015       JAN     FEB     MAR     APR     MAY

No. of Employees   (???)             285     290      295        287     291

WHEN I SELECT:  YEAR 2015 AND MONTH JAN IT GIVES ME 285
BUT I NEED ... IF I SELECT ONLY  YEAR 2015 ON MY YEAR LIST BOX

RESULT SHOULD BE TAKEN FROM LAST MONTH ( WHICH IS MAY)  EMPLOYEES AT (???) IN MY TABLE

second:   if i click year 2014   the result should be the number of employees in last month( December 2014)

MY EXPRESSION IS  LIKE THIS

=num(Count(distinct{$<Year = {$(=Max(Year))}, Month= {"$(=max({<Year={$(=max(Year))}>} Month))"}, CAL_Month=,[Dept Code]= {'5555'}>} [Employeeid]))

Highlighted
Not applicable

Re: Selecting LAST MONTH

thanks but read my detailed reply in below

it is not working with me

Highlighted
Not applicable

Re: Selecting LAST MONTH

it is not working with me

i have written in above detail in my reply please review it

thanks

Highlighted
Partner
Partner

Re: Selecting LAST MONTH

Hi Tahir,


Check the Month field. I presume that the Month field has string (ie., Apr, May ....), you can create another filed to identify the month as numeric (i.e, 1,2,3,4,5,6,7,8,9,10,11,12), as Max and min functions does not work on string. Please share a sample app, so that we can have a look.

View solution in original post

Highlighted

Re: Selecting LAST MONTH

Hi

Hope you have date field,

=num(Count(distinct{<Date = {">=$(=MonthStart(Max(Date))) <= $(=MonthEnd(Max(Date)))"}, CAL_Month=,[Dept Code]= {'5555'}>} [Employeeid]))

Highlighted
Not applicable

Re: Selecting LAST MONTH

yes my month field is date field it will take the last day of the month