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: 
krishna20
Specialist II
Specialist II

finding min and max status in expression

           Hi Friends,

I have a Requirement like The Below

when user select multiple month we need to take min status and max status

then we need to compare whether status is same if status is same we need not count

Ex:--if u select jan and feb month jan min status is positive and feb max status is feb

this senario we need not count

could any one suggest me the best solution

Thanks

Input

ACCOUNT_IDPREVCLUSTERCURRCLUSTERPREV_FOR_STATUSCURR_FOR_STATUScluster_indSTART_DATEEND_DATEMonthYearQuarter
235863positiveNeutralUnrestrictedIn ProgressNeutral10/12/201520/12/2015Dec-15Q4
235863NeutralpositiveIn ProgressApprovedpositive16/01/201620/01/2016Jan-16Q1
235863positiveNagativeApprovedBlacklistNagative11/02/201620/02/2016Feb-16Q1
235863NagativeNeutralBlacklistNApositive16/03/201620/03/2016Mar-16Q1
235863NeutralpositiveNAApprovedpositive05/05/201610/05/2016May-16Q2
235863positiveNagativeApprovedRejectedNagative05/06/201612/06/2016Jun-16Q2
235863NagativeNeutralRejectedNonepositive04/07/201608/07/2016Jul-16Q3
235863NeutralNagativeNoneRejectedNagative14/08/201620/08/2016Aug-16Q3
235863NagativepositiveRejectedApprovedpositive05/10/201610/10/2016Oct-16Q4
235863positiveNeutralApprovedIn ProgressNeutral09/12/201612/12/2016Dec-16Q4
1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi

this should work for you

=sum(aggr(if(only({<MonthYear={'$(=min(MonthYear))'}>}CURR_FOR_STATUS)<>only({<MonthYear={'$(=max(MonthYear))'}>}CURR_FOR_STATUS),1,0),ACCOUNT_ID))

View solution in original post

4 Replies
sunny_talwar

How are you estimating the status? based on dates?

May be this:

If(FirstSortedValue(PREVCLUSTER, -MonthYear) = FirstSortedValue(PREVCLUSTER, MonthYear), 1, 0)

lironbaram
Partner - Master III
Partner - Master III

hi

this should work for you

=sum(aggr(if(only({<MonthYear={'$(=min(MonthYear))'}>}CURR_FOR_STATUS)<>only({<MonthYear={'$(=max(MonthYear))'}>}CURR_FOR_STATUS),1,0),ACCOUNT_ID))

krishna20
Specialist II
Specialist II
Author

yes

your correct

sunny_talwar

So is the above expression working or not?