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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
jagdishbr
Contributor III
Contributor III

Create dimension category as Top20, Next 20 and rest

Hi I'm new to Qlik sense and I'm encountering a problem. I'm trying to achieve the following task and Tried below expression and ended up having only one category in the table 

Category to be created based on Sales.

Region Category Sales Profit
APAC Top 20    
Next 20    
Rest    
Global Top 20    
Next 20    
Rest    
Americas Top 20    
Next 20    
Rest    

 

Tried Below Expressions:

1.

If(Aggr(Rank(TOTAL Sum({<Region={'APAC','Americas','Global'}>} Sales), 1, 1), Region) <= 20, 'Top 20',   If(Aggr(Rank(TOTAL Sum({<Region={'APAC','Americas','Global'}>} Sales), 1, 1), Region) > 20 and
      Aggr(Rank(TOTAL Sum({<Region={'APAC','Americas','Global'}>} Sales), 1, 1), Region) <= 40, 'Next 20', 'Rest'))

2.

If(Aggr(Rank(TOTAL Sum({<Region={'APAC','Americas','Global'}>} Sales)), Region) <= 20, 'Top 20',   If(Aggr(Rank(TOTAL Sum({<Region={'APAC','Americas','Global'}>} Sales)), Region) <= 40, 'Next 20', 'Rest'))

3.If(Aggr(Rank(TOTAL Sum(Sales), 1, 1), Product) <= 20, 'Top 20', If(Aggr(Rank(TOTAL Sum(Sales), 1, 1), Product) > 20 and Aggr(Rank(TOTAL Sum(Sales), 1, 1), Product) <= 40, 'Next 20', 'Rest'))

None of the expressions above are producing the desired results. could you please provide some guidance on the issue?

 

Labels (5)
1 Reply
Sayed_Mannan
Creator II
Creator II

try this,

Aggr(
If(Rank(TOTAL Sum(Sales), 1, 1) <= 20, 'Top 20',
If(Rank(TOTAL Sum(Sales), 1, 1) > 20 and Rank(TOTAL Sum(Sales), 1, 1) <= 40, 'Next 20', 'Rest')
),
Region, (TOTAL <Region>)
)