Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Daya_Qlik
Contributor II
Contributor II

Set analysis is not working with aggr

Hi,
We have a scenario to show latest job description for an employee based on the max change date.
I have tried using aggr() with set analysis.


"Max(Aggr(Max({<$(vIgnoreTimeSel), [flag for area alighment]={1}, _Flag_Job_Alignment={1}, _Flag_Restaurant={1}, _Flag_Termed={0}>}
[Change Date])
,[Employee Full Name], [Job Desc]))"


Table: 

Employee Full NameJob DescChange Date
ABCShift Manager3/16/2020
ABCShift Manager In-Training2/10/2020
ABCTeam Trainer9/23/2019

 

Expected Output:

Employee Full NameJob DescChange Date
ABCShift Manager3/16/2020

 

 

Thanks.

 

 

1 Solution

Accepted Solutions
tresesco
MVP
MVP

I guess if you could use firstsortedvalue() instead, it would be easier. Try like:

FirstSortedValue(<Set analysis> [Job Description], -[Change Date])

View solution in original post

8 Replies
tresesco
MVP
MVP

I guess if you could use firstsortedvalue() instead, it would be easier. Try like:

FirstSortedValue(<Set analysis> [Job Description], -[Change Date])

agigliotti
Partner - Champion
Partner - Champion

Hello @Daya_Qlik ,

You could try with:

=Aggr( Max( {< $(vIgnoreTimeSel), [flag for area alighment] = {1}, _Flag_Job_Alignment = {1}, _Flag_Restaurant = {1}, _Flag_Termed = {0} >} [Change Date] ), [Employee Full Name] )  for "Change Date" dimension 

and

=Aggr( if( [Change Date] = Max( {< $(vIgnoreTimeSel), [flag for area alighment] = {1}, _Flag_Job_Alignment = {1}, _Flag_Restaurant = {1}, _Flag_Termed = {0} >} [Change Date] ), [Job Desc] ), [Employee Full Name] )  for "Job Desc " dimension 

I hope it can help.

Best Regards

AnalyticsBoost
Contributor III
Contributor III

=if(min(total aggr(rank(total Num(Date#([Change Date], 'MM/DD/YYYY'))),[Job Desc]))=rank(total Num(Date#([Change Date], 'MM/DD/YYYY'))) ,[Job Desc])

 

Daya_Qlik
Contributor II
Contributor II
Author

Hi Agigliotti,

Thank you for your solution.

We applied the given formula, the job description is showing blank.

DayaWendys_1-1633513085094.png

Can you please check and thanks in advance.

 

 

agigliotti
Partner - Champion
Partner - Champion

give a try using  [Job Desc] as dimension...

Daya_Qlik
Contributor II
Contributor II
Author

we have taken [job desc] as a dimension and [change date] as measure.

Daya_Qlik
Contributor II
Contributor II
Author

Hi Tresesco,

 

Thanks for the solution. It worked.

 

Thanks.

agigliotti
Partner - Champion
Partner - Champion

I said above to use both as dimensions even [change date].