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

FirstSortedValue Help

Hi,

I'm having some trouble using FirstSortedValue and could use some help.

I have the following Tables: AccountInfo and BalanceInfo

AccountInfo looks like:  

Key

Account#EffectiveDate
123010120121231/1/2012
124010120121241/1/2012
123020120121232/1/2012

Balanceinfo Looks like:

KeyBaLIDBalanceStatus
1230101201213.00Open
1230101201225.00Open
12401012012315.00Open
12401012012410.00Open
12302012012515.00Open
12302012012620.00Closed
12302012012730.00Open

I have a 1:M relationship between Account and Balance Info.  I'd like to be able to return the count and balances associated with the most recent open accounts.  So for Account 123 I would return count of 2 and balance of 45.  For account 124 I would want to return count of 2 and balance of 25.

I'm currently using sum((AGGR(firstsortedvalue({<Status={'Open'}>}Balance,-EffectiveDate),Account))) to calculate the total Balance, which seems to work, but I can't figure out how to determine the count.

I assumed using firstsortedvalue would be the way to go, but I am open to other suggestions.

Any help would be appreciated.

11 Replies
Not applicable
Author

hi chris,

if u found Solution  then please mark this Discussion as answered

so it will help those who are facing same type of problem

thanks And regards

MK_QSL
MVP
MVP

We are glad that you found your solution.

Just for curiosity, what was wrong in our solution?

After checking your solution, found that it will not work for Status Open as your have given generalized answer and nowhere mentioned Status = OPEN !!!

Can you check our solutions also and match with your one so that you can identify what was wrong /