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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
melodyxu
Contributor
Contributor

How to display Null value first and then descending display in table field?

I edit sheet to add a expression in sorting for date field sorting.

In this date field soring, Null value first need display on the top and then others descending displays.

And I try to use these expression, but failed.

If( IsNull([datefield]), 1, 0) & '-' & -[datefield]

If(IsNull(datefield]), date(now()), [datefield])

what should I do? 

melodyxu_1-1740476572361.png

 

 

 

 

 

 

1 Reply
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

I think the problem is that you are using the NULL value in your expression - any operations with NULL will results in NULL. Here is what I'd recommend:

IF( IsNull(DateField), DUAL('-', 0), DateField)

This formula should replace NULL values with dual values that will get sorted before any non-null values.

There might be another hidden issue. Sometimes, depending on the data structure, you may see something that appears as a NULL value, but instead it's a "missing value" - that value doesn't exist, based on the way different data elements are associated. In that case, this formula won't help because DateField is not NULL, but it's rather missing at all.

Hope it helps, cheers!