Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Highlighted
poojashribanger
Contributor II

Set analysis

MONTH_KEY.PNG

I have month_key and date field.

now i want to select yearstart i.e. April  month_key dynamically.

if it is 2018 then month_key should be 201804 .


(sum({<Month_key={"201704"} ,emp_cat_code={'R'},officer_cd = {'*'}-{'CD'}>} QTR_OPEN_CNT)+

   sum({<Month_key={"201710"} , emp_cat_code={'R'},officer_cd = {'*'}-{'CD''}>} QTR_CLOSE_CNT))/2)

Please help

Tags (2)
1 Solution

Accepted Solutions
Partner
Partner

Re: Set analysis

Make this small change:

sum({<Month_key={"$(=Date(YearStart(Max(Date),0,4),'YYYYMM'))"} ,emp_cat_code={'R'},officer_cd = {'*'}-{'CD'},YearField=>} QTR_OPEN_CNT)

7 Replies
Partner
Partner

Re: Set analysis

For Latest YearStart you can say

Date(YearStart(Max(Date),0,4),'YYYYMM') - this will give you Year Start of Month_Key for Selected Year

poojashribanger
Contributor II

Re: Set analysis

i want to get monthkey

poojashribanger
Contributor II

Re: Set analysis

you can see in my set analysis i have hard coded the value but i want it to get selected dynamically

Partner
Partner

Re: Set analysis

For this

sum({<Month_key={"201704"} ,emp_cat_code={'R'},officer_cd = {'*'}-{'CD'}>} QTR_OPEN_CNT)

You can use

sum({<Month_key={"$(=Date(YearStart(Max(Date),0,4),'YYYYMM'))"} ,emp_cat_code={'R'},officer_cd = {'*'}-{'CD'}>} QTR_OPEN_CNT)+

poojashribanger
Contributor II

Re: Set analysis

if i select year as 2018 will it change dynamically to 201804?

Partner
Partner

Re: Set analysis

Yes..(If you have data for 201804)

Partner
Partner

Re: Set analysis

Make this small change:

sum({<Month_key={"$(=Date(YearStart(Max(Date),0,4),'YYYYMM'))"} ,emp_cat_code={'R'},officer_cd = {'*'}-{'CD'},YearField=>} QTR_OPEN_CNT)