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: 
jumiprado
Creator
Creator

Aggr function ? I need to make a ranking

Hey guys!

I have the following table

COMPANYAREASUB AREAPERIODDAYS
COMPANY AAREA 1SUB_A1JAN-1810
COMPANY AAREA 1SUB_A1FEB-1815
COMPANY AAREA 2SUB_A2JAN-185
COMPANY AAREA 2SUB_A2FEB-1820
COMPANY AAREA 3SUB_A3JAN-1830

I need to make a pivot table that makes a ranking with top 10 with days but calculating that grouped for the dimensions

I hope you understand my poor english!

Thanks!

stalwar1

swuehl

2 Replies
sunny_talwar

What is the expected output needs to look like?

Anil_Babu_Samineni

Not sure i understand the business, But this will help better?

SUM({<COMPANY = {"=Rank(SUM({<DATE = {">=$(=Date(Max(DATE-10)))<=$(=Date(Max(DATE)))"}>} DAYS))<=10"}, DATE = {">=$(=Date(Max(DATE-10)))<=$(=Date(Max(DATE)))"}>}DAYS)


Or

Dim1 =IF(Aggr(Rank(SUM(DAYS), COMPANY)<=10, COMPANY)

Dim2 =IF(Aggr(Rank(SUM(DAYS), AREA)<=10, AREA)

Dim3 =IF(Aggr(Rank(SUM(DAYS), [SUB AREA])<=10, [SUB AREA])

Dim4 =IF(Aggr(Rank(SUM(DAYS), PERIOD)<=10, PERIOD)


Expression = Sum(DAYS)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful