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: 
poojashribanger
Creator II
Creator 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

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

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)

View solution in original post

7 Replies
shraddha_g
Partner - Master III
Partner - Master III

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
Creator II
Creator II
Author

i want to get monthkey

poojashribanger
Creator II
Creator II
Author

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

shraddha_g
Partner - Master III
Partner - Master III

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
Creator II
Creator II
Author

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

shraddha_g
Partner - Master III
Partner - Master III

Yes..(If you have data for 201804)

shraddha_g
Partner - Master III
Partner - Master III

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)