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

Expressions

**Update**

I have this straight table expression ==count({<Date = {[<>NULL]}>}distinct ID)

I really need to understand what is being counted and how would I write the above expression in the script editor, something like this, IF(date <> 'NULL', 1,0) as DateCount? (Where would I add the distinct ID)

1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Ok then, your expression if(date <> 'NULL',1,0) as DateCount looks fine for me.

Try the Expression : Sum(Distinct DateCount)

View solution in original post

10 Replies
Not applicable
Author

Untitled.png

Colin-Albert

The expression is showing a distinct count of ID, for rows in the current dataset where the Date is not null

Anonymous
Not applicable
Author

Thanks, I've updated my question to be more clear. Would you mind taking a look?

Anonymous
Not applicable
Author

How would that look in the script editor?

NareshGuntur
Partner - Specialist
Partner - Specialist

Hi John,

I think there is an issue with the expression.

<>NULL will not be treated as "not equals to". It should be written as Date =- {[NULL]}.

Here, it will consider only the greater than symbol.

Cheers,

Naresh

Colin-Albert

It depends on your data model.

Are the Date fields and ID fields in the same table?

If yes, then you could add this to your load script      if(Date, 1) as DateCount

then use sum(DateCount) in your charts

settu_periasamy
Master III
Master III

Hi,

Do you have Null Value in your Date Field? Then, you can try this in the script, Like

if(isNull(Date) or Len(Trim(Date))>0,1,0) as DateCount

in Expression something like..

=count(Distinct {<DateCount={1}>} ID)

or

=Sum(Distinct DateCount)

Anonymous
Not applicable
Author

Null is the acutal value in the field.

My straight table Expression is ==count({<Date = {[<>NULL]}>}distinct ID)

Really wanting to write this out in the scrip editor and just sum in the charts.

Something list this...IF(date <> 'NULL', 1,0) as DateCount? Will this work and does it take into account the "distinct ID" piece of the first expression?

Anonymous
Not applicable
Author

Okay on the right track! There are not null values but there is a value called "NULL"