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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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
tresB
Champion III
Champion III

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
tresB
Champion III
Champion III

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

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

agigliotti
MVP
MVP

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
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
MVP
MVP

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
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
MVP
MVP

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

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it