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

Creating a script function that also returns NULL

Hi,

In my model I try to create a variable that contains a formula that returns the content from a table given a current selection, but i also want it to return the NULL (blank) value when the cell is blank.

Now, my script looks like this:

let vVariable = 'sum({$<KV_Start_Date = {"< =' & ' $ ' & ' (=min(Date))"}>} KV_Actual_Value)

In practice, the data table containing KV_Value_Actual only have one cell for each selection. Thus, I'm actually only trying to get the content of the cell in the table returned by the function.

I find that the "sum" function returns blank cells as 0, not Null().

This is an example of the content I want the formula to return:

SelectionKV_Value_ActualWhat I want the formula to return
A100100
B5050
C
D00

Appreciate all help

1 Reply
swuehl
MVP
MVP

Try the only() function instead of sum()

let vVariable = 'only({$<KV_Start_Date = {"< =' & ' $ ' & ' (=min(Date))"}>} KV_Actual_Value)