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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Set Analysis inside of other Set Analysis

Hi Community!

I have a problem using set analysis and I was wondering if you can assist me please. I’ve been dealing with the issue and I can’t this get to work.

I have a data set, and I want to get the latest transaction for a period range.

For example: My period date range is >=09/02/2011 (vStartPPFormat) and <=09/01/2012(vEndPPFormat), therefore my latest value is 192.881 on 8/21/2012. All the fields change constantly, so there’s nothing that I can say on this TC_TXN_TYPE, or on this date.

 

1.png

I don’t seem to find the way to calculate this.

I first calculated the Maximum Date: =Max({<GV_OBJ_ID={619}, CalendarDate={'>=$(vStartPPFormat)<=$(vEndPPFormat)'}>}GV_VALUE_DATE) . With this I got the 8/21/2012 which is correct ,and then I want to use that date in a new expression. I can’t put that expression in a variable, because it will get the max date for all benefits plans, so if some benefit plan has a date of 8/31/2012, it will get me that date, but for this example 8/31/2012 won’t work. I need the maximum date for each benefit plan.

Then I did the following expression to get the 192.881.

MAX( {$<CalendarDate = {"=Max({<GV_OBJ_ID={619}, CalendarDate={'>=$(vStartPPFormat)<=$(vEndPPFormat)'}>}GV_VALUE_DATE)"}>} GV_DOUBLE_VALUE )

And instead of getting the 192.881 I’m getting 193.25, which is the maximum of everything. It’s like it’s not taking in mind the date 8/21/2012

2.png

Attached are my files.

Thanks a lot.

P!

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

try this

FirstSortedValue( {<GV_OBJ_ID={619}, CalendarDate={'>=$(vStartPPFormat)<=$(vEndPPFormat)'}>} Aggr(Max(GV_DOUBLE_VALUE), BenefitPlan, CalendarDate) , -Aggr(CalendarDate,BenefitPlan,CalendarDate))

View solution in original post

4 Replies
MayilVahanan

HI

try like this

=MAX( {$<CalendarDate = {"$(=Max({<GV_OBJ_ID={619}, CalendarDate={'>=$(vStartPPFormat)<=$(vEndPPFormat)'}>}GV_VALUE_DATE))"}>} GV_DOUBLE_VALUE )

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

try this

FirstSortedValue( {<GV_OBJ_ID={619}, CalendarDate={'>=$(vStartPPFormat)<=$(vEndPPFormat)'}>} Aggr(Max(GV_DOUBLE_VALUE), BenefitPlan, CalendarDate) , -Aggr(CalendarDate,BenefitPlan,CalendarDate))

Not applicable
Author

Hi Celambarasam,

The FirstSortedValue function worked. What I don't understand is why you have to aggregate?

Thanks a lot!

Not applicable
Author

Hi Mayil,

This will work only when you click on a specific contract, if you clear the selections it won't work. I've tried this before.

Thanks.