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: 
kunkumnaveen
Specialist
Specialist

How to write the Expression

Hello All,

I am  trying to show case  top 4 value in a pivot table, the below expression I have used  is working partially 

Expression :  if(Rank(total Sum(Sales),4,1)<=4,sum(Sales))

Output:

Capture.PNG

I am having two issues over here 

                                                      1) I am showcasing the top4 values hence it should show only those rows not the Null/Blank rows

                                                      2) After getting top4 I need showcase them in Descending order

 

How can I achieve the above two requirements

 

Thanks

3 Replies
kunkumnaveen
Specialist
Specialist
Author

Any suggestion on the above  issue will be helpful 

HirisH_V7
Master
Master

- Data Handling and nulls can be removed.

- Then sort it accordingly.

 

HirisH
Vikash
Contributor III
Contributor III

Hi,

1. To remove the null/Missing Values check below-

        =if(rank(sum(Sales))<=4, sum(Sales))  add this as expression

        =aggr(if(rank(sum(Sales))<=4,GUID),GUID) add this as calculated dimension

2. for sorting of these values in a Pivot table you need to add the sorting expression under the sort tab as per your requirement like-  =if(rank(sum(Sales))<=4, sum(Sales)) 

Else you can use straight table  and make the sorting on the expression.

VK