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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Nemo1
Creator II
Creator II

Why is this easy formula not working for me?

Hello dear developers, 

 

I am trying an easy formula but somehow it is not working out for me. 

I am setting up a table, and it is showing a dimension, where many values are null values, so an ugly "-" is displayed. Instead of that, I would like to have a legend.

This is the formula I am using: 

= if(IsNull(Vendor), 'No vendor', Vendor)

 

any help is appreciated! 😄 

 

thanks 

Labels (3)
1 Solution

Accepted Solutions
LRuCelver
Partner - Creator III
Partner - Creator III

The formula works, although I would use this one instead so you can select filters from the table:

=Aggr(If(IsNull(Vendor), 'No vendor', Vendor), Vendor)

 Why it is not working for you I don't know. Here are a few things you can try:

  • Check whether the "-" is actually NULL or whether it is a string
  • Fill the NULL values in the script. There are several options:
    • Use NullAsValue to replace the missing values (see code below)
    • Use your expression in the script
    • If vendors are linked to a fact table via an ID, add a new ID for missing vendors (e.g. -1) and concatenate a corresponding row to the vendor table.
NullAsValue Vendor;
Set NullValue = No vendor;

// Load the final field here

NullAsNull;

 

View solution in original post

6 Replies
Clement15
Partner - Specialist
Partner - Specialist

Hello, I think this might work

Coalesce(Vendor,'No Vendor')

Nemo1
Creator II
Creator II
Author

No, it did not change anything , still showing the "-" 😞

LRuCelver
Partner - Creator III
Partner - Creator III

The formula works, although I would use this one instead so you can select filters from the table:

=Aggr(If(IsNull(Vendor), 'No vendor', Vendor), Vendor)

 Why it is not working for you I don't know. Here are a few things you can try:

  • Check whether the "-" is actually NULL or whether it is a string
  • Fill the NULL values in the script. There are several options:
    • Use NullAsValue to replace the missing values (see code below)
    • Use your expression in the script
    • If vendors are linked to a fact table via an ID, add a new ID for missing vendors (e.g. -1) and concatenate a corresponding row to the vendor table.
NullAsValue Vendor;
Set NullValue = No vendor;

// Load the final field here

NullAsNull;

 

BrunPierre
Partner - Master II
Partner - Master II

@Nemo1 Null is different from a blank, and I prefer handling this differentiation at the backend.

If(Len(Trim(Vendor)), Vendor, 'No Vendor') as Vendor

Nagaraju_KCS
Specialist III
Specialist III

Try this 

If(Len(Trim(Vendor))=0, 'No Vendor', 'Vendor')

Nemo1
Creator II
Creator II
Author

It did work, thanks!!