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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
krishna20
Specialist II
Specialist II

Finding min and max based on selection

Hi Friends,

I have an requirement from the client side that is saying

my input is

    

ACCOUNT_IDSTART_DATEPREVCLUSTERCURRCLUSTER
23586301/01/2016NeutralPositive
23586301/02/2016PositiveNegative
23586301/03/2016NegativeNeutral
23586301/05/2016NeutralPositive
23586301/06/2016PositiveNegative
23586301/07/2016NegativeNeutral
23586301/08/2016NeutralNegative
31616801/01/2016NegativePositive
31616801/01/2016NeutralPositive
31616801/02/2016PositiveNegative
31616801/03/2016NegativeNeutral
31616801/04/2016NeutralNegative
31616801/05/2016NegativeNeutral
31616801/06/2016NeutralNeutral
31616801/07/2016NeutralPositive
31616801/08/2016PositiveNeutral
31616801/09/2016NeutralPositive
39739401/01/2016PositiveNegative
39739401/02/2016NegativeNeutral
39739401/03/2016NeutralPositive
39739401/04/2016PositiveNegative
39739401/05/2016NegativeNeutral
39739401/06/2016NeutralNegative
39739401/08/2016NegativePositive

What we need out put here

Scenario1: user select multiple months we need to take min month of PREVCLUSTER and max month of CURRCLUSTER

output:if we selected jan_apr for 235863  min start date of PREVCLUSTER Nuetral and there is no apr month for this account id

this senario we need to take mar as max start date and calculate


Senario2: if you select apr to july for 235863   there is no records for that range of selection

out put:  we need to take may month of PREVCLUSTER and jun month of CURRCLUSTER



do you have any idea on this please suggest me



Thanks



2 Replies
Not applicable

Hi Krishna ,

Small clarification ,are you expecting output is date or account -id

sunny_talwar

This?

Capture.PNG

Expressions

1) =FirstSortedValue(Aggr(Concat(DISTINCT PREVCLUSTER, ', '), START_DATE, ACCOUNT_ID), Aggr(START_DATE, ACCOUNT_ID, START_DATE))

2) =FirstSortedValue(Aggr(Concat(DISTINCT CURRCLUSTER, ', '), START_DATE, ACCOUNT_ID), -Aggr(START_DATE, ACCOUNT_ID, START_DATE))