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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can anybody please clarify this issue?

Position should come 1 2 3 4 5 in order wise and Others field should come bottom of the table (in last row)

13 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can set the Sort order and as per that the null will go at bottom.

Go to Properties of chart -> Sort -> Take "Position" field on top.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

If we take "Position field" on top Null value is coming on first row but Null value should come bottom side after Position 1 2 3 4 5.

Please suggest me how to proceed to sort it out this issue.

MK9885
Master II
Master II

Maybe sort it by

Properties>Sort>Category>Expression>

rank(aggr([Candidate Name]='Others',[Candidate Name])) and then select Ascending.

kamielrajaram
Creator III
Creator III

Hi,

What is the data type for the position field? I would try setting it to a integer. Select settings, document properties, number tab, select the position field and make it an integer. Then try to sort ascending

Kamiel

Not applicable
Author

 

You can create a mapping table and load ordering on category column, involves two load statements.

 

Or simply sort on two columns as attached

 

 

Sorting.png

Final.png

Not applicable
Author

Hi Arjun,

If Position value is always '-' or null for "Others", then I think this can help you out.

In Properties>Sort>Expression

=if(Position ='-',999999999,F1)               { Keep ascending}

if its a null value

=if(IsNull(Position ),999999999,F1)

tamilarasu
Champion
Champion

Hi Arjun,

Go to Properties -> Sort -> Expression -> Select Ascending -> Copy and paste the below expression


If(Len(Trim(Position))=0,Max(Total Position)+1,Position)

trdandamudi
Master II
Master II

Nagaraj expression will work perfectly on the front end. In case if you need to resolve on the script side then the following will work:

Sort_Order_1.jpg

Source_Data:

LOAD * INLINE [

Constituency,CandidateName,Category,PartyFullForm,Position,TotalVotes

Ajagara (SC),Others,,,,17347

Ajagara (SC),TRIBHUVAN RAM,SC,Bahujan Samaj Party,1,60239

Ajagara (SC),LALJI,SC,Samajwadi Party,2,58156

Ajagara (SC),HARINATH,SC,Bharatiya Janata Party,3,22855

Ajagara (SC),SANT KUMAR,SC,Apna Dal,4,16563

Ajagara (SC),MEVA LAL BAGI,SC,Indian National Congress,5,11054];

Final_Data:

NoConcatenate

Load *,RecNo() as X

Resident Source_Data

Order by Position desc;

Drop Table Source_Data;

krishna20
Specialist II
Specialist II

yes its working right