Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
nadkalyan
Partner - Creator
Partner - Creator

Sorting Nulls at last row

Hi , I have a straight table with a dimension and several Expressions. I did sort Dimension By Text A-->Z . It was working fine until Null Values dont come up. Null Value for dimension is coming on first row. How can i show Null Value at end(last row) still keeping my original sort for other dimension values A-->Z.

5 Replies
manojkvrajan
Luminary
Luminary

Simplest solution is to introduce a flag field for this null value and use the expression sort in descending/ascending. However, you can hide the column. I understand it is little gruelling work however, this is the shortest workaround to meet the requirement.

manojkvrajan
Luminary
Luminary

Please upload a sample qvw and see if I can be of any help.

nadkalyan
Partner - Creator
Partner - Creator
Author

Manoj,

Attached is the sample QVW file. I tried using Expression sort , still same issue. Any assistance will be highly appreciated.

Thanks

Kalyan

manojkvrajan
Luminary
Luminary

Kalyan, I dint make any change to your qvw document. However, I just handled the script to address the null issue. Please use the IF (IsNull(Data)=-1 OR Data = '',null(),Data) AS Data in your extraction script if your data is small. Otherwise Resident load will also be an option to address this requirement. Attached is the sample. I hope it helps.

Anonymous
Not applicable

The original qvw appears to have been taken down, but if the temporary table in the Sort Null_Solution is the same, it looks like it's the blank value that gets sorted to the top row, not a null value. In that case the solution is as simple as the sort expression "If(Data = '',1,0) ." Anything greater than "1" can be put in its place in the If statement.

I've had an issue with nulls that refused to move the bottom row. I realized that the chart type was accidentally selected as a Pivot Table rather than Straight Table. The sort expression above won't work in a pivot table.

I hope that can help someone.