Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
Try this
=Sum({$<Month={$(=Max(Month))}>}Sales)
Use below expression:
Sum({<Year={$(=Max(Year))}, Month= {"$(=max({<Year={$(=max(Year))}>} Month))"},Month= >}Sales)
Both will work fine but Sum({$<Month={$(=Max(Month))}>}Sales) is much easier 🙂
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]))
thanks but read my detailed reply in below
it is not working with me
it is not working with me
i have written in above detail in my reply please review it
thanks
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.
Hi
Hope you have date field,
=num(Count(distinct{<Date = {">=$(=MonthStart(Max(Date))) <= $(=MonthEnd(Max(Date)))"}, CAL_Month=,[Dept Code]= {'5555'}>} [Employeeid]))
yes my month field is date field it will take the last day of the month