Qlik Community

Ask a Question

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Support Case Portal will move to Qlik Community Oct 4. Temporary case outage Oct 3. READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
gagewhite
Contributor III
Contributor III

Ranking Year and Quarter as Dimension

Hello,

I am trying to rank the most recent year and quarter for us and our competitors so I can show trends for the most recent four quarters of data on a line chart, but cannot figure out how to make the ranking reset for each company. For example, this is what my data looks like before ranking:

CompanyCompany OwnerYearQuarterRank
Company 1My Company20191 
Company 1My Company20192 
Company 1My Company20193 
Company 1My Company20194 
Company 2Competitor20184 
Company 2Competitor20191 
Company 2Competitor20192 
Company 2Competitor20193 
Company 3Competitor20183 
Company 3Competitor20184 
Company 3Competitor20191 
Company 3Competitor20192 

 

As you can see, the most recent quarters:

  • Company 1: 2019 Q4
  • Company 2: 2019 Q3
  • Company 3: 2019 Q2

I would like the ranking to behave as followed:

CompanyCompany OwnerYearQuarterRank
Company 1My Company201914
Company 1My Company201923
Company 1My Company201932
Company 1My Company201941
Company 2Competitor201844
Company 2Competitor201913
Company 2Competitor201922
Company 2Competitor201931
Company 3Competitor201834
Company 3Competitor201843
Company 3Competitor201912
Company 3Competitor201921

 

This way only way that ranks these appropriately is Max(TOTAL <Company> Year*4+Quarter) - Max(TOTAL <Year,Quarter> Year*4+Quarter) + 1, but I need the ranking as a dimension, not a measure. Any help is greatly appreciated!

1 Solution

Accepted Solutions
gagewhite
Contributor III
Contributor III
Author

Figured out a way to, essentially, turn this measure into a dimension in case anyone was curious:

Aggr(Max(TOTAL <Company> Year*4+Quarter) - Max(TOTAL <Year,Quarter> Year*4+Quarter) + 1, [Year], [Quarter], [Company])

View solution in original post

1 Reply
gagewhite
Contributor III
Contributor III
Author

Figured out a way to, essentially, turn this measure into a dimension in case anyone was curious:

Aggr(Max(TOTAL <Company> Year*4+Quarter) - Max(TOTAL <Year,Quarter> Year*4+Quarter) + 1, [Year], [Quarter], [Company])

View solution in original post