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

Rank Function in load script

Hi guys

I am looking to Rank Rejection reasons as per the frequency they occur.

I have the Rejection reasons loading from an excel spreadsheet , where the rejection reasons are all listed in one cell - so I have split out each reason on load using the below.

if(trim(upper(subfield([Rejection Reasons], ',')))='',null(),trim(upper(subfield([Rejection Reasons], ',')))) as ReasonSub

I now would like to rank it in the script ,as I do not want the rankings to change when certain filters are selected in the chart .

Can anyone advise if this can be done and if so any pointers greatly appreciated

Thanks


A

15 Replies
Not applicable
Author

Using the script as I pasted it in , this is the chart

ReasonSubsNumber of RejectionsRankCorrect  Rank
Incorrect Docket36321
Fire Damage15052
Under use14243
Bad Rate12334
Trade Green11875
Knife Sharp11266

So Rank is the result and Correct Rank is the desired result

To be honest Im not too concerned about ranking at customer level , I just want to see the most popular rejection reasons

In the chart I used expression

rank(sum({$<[Approved? N/Y] = {"*No*"}>}Numbers),ReasonSubs,1)

And this worked fine - but I really would like to show the ranking whilst not effected by filters

Thanks

 

nagaiank
Specialist III
Specialist III

Rank function is available for use in chart expressions only.It is not available in load scripts. In load script, you may use Order By.

swuehl
MVP
MVP

I am slow from time to time, but I am not seeing how just repeating your message helps me here.

In your expression

rank(sum({$<[Approved? N/Y] = {"*No*"}>}Numbers),ReasonSubs,1)

how do you derive Numbers? Can't see it in your script.

What does the ReasonSubsCount show when compared to your Number of Rejections?

If I understand your request correctly, I still think that calculating the rank in the script should be possible using a count (or whatever appropriate) in a group by load and the assign a rank number in a order by load.

If it's all about creating a rank expression in the front end that is not sensitive to selections, you can try using set analysis (set identifier 1).

See attached.

Not applicable
Author

OMG Swuehl

Sorry I didnt mean to repost ( that must look rude - sorry !!!) Sometimes my I get errors when posting a message onto the forum and then it posts twice ,

Let me have a look at making a dash that explains my issue

Thanks

A

Not applicable
Author

Hi guys

Thanks for your time on this -- the issue is with my data model

I have rewrite most of the script to accomodate what I require now

Thanks for your posts they will deffo assist when I go to redesign the dash

A

Not applicable
Author

Hi guys

Thanks for your time on this -- the issue is with my data model

I have rewrite most of the script to accomodate what I require now

Thanks for your posts they will deffo assist when I go to redesign the dash

A