Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ramrongala
Contributor II
Contributor II

how to show top 1 , above 2 and below 2 rankings based on user selection in table

Hi Experts,

Requirement : user select any product then based on ranking it should show before 2 , after 2 rankings and top 1 ranking should as default(please have a look below  output screenshot)  

Below is the sample  data

ramrongala_0-1624943879863.png

need to show output as below :

ramrongala_1-1624943966376.png

Please help to resolve the isuue.

3 Replies
PrashantSangle

How much complex your data model? 

are you looking for something like this

PrashantSangle_0-1624946754917.png

 

Find below Script

Test:
LOAD Product,
Sales
FROM
Ranking.xlsx
(ooxml, embedded labels, table is Sheet1);


NoConcatenate
Test1:
Load *,RowNo() as rank
Resident Test
Order By Sales desc;

drop Table Test;
EXIT SCRIPT;

 

In front end

chart > table

Dimension : rank, Product

Measure: Sum({<rank={1}>+<rank={">=$(=max(rank)-2)<=$(=max(rank)+2)"}>}Sales)

 

Thanks & Regards,

Prashant Sangle

 

 

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
ramrongala
Contributor II
Contributor II
Author

HI Prashant,

We need the ranking  calculation in frontend and user select one product not ranking.

ramrongala
Contributor II
Contributor II
Author

HI Prashant,

requirement got changed, now we have to show +2 and -2 sales based on selection like below.

sample data:

ramrongala_0-1625053141882.png

 

 output should be: +2 , -2 sales  and top sales(here user select bikehelmet)

ProductSum(Sales)
Cars32000
Wheels9800
SpareParts6000
Bike helmet4000
Car speakers3700
Bike2600