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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Null value causing problems

Let

LET vFcst_Invoices =if($(InvoiceEveryTest)=-1,0,round($(vFcstMonths)/ $(vInvoiced_Every)));

InvoiceEveryTest = isnull(vInvoiced_Every);



When my code hits a record where vInvoiced_Every is a null it falls over.

When I look at the debugger it shows that the first part of the if : $(InvoiceEveryTest)=-1 is -1 = -1

but it falls over I can not see why it does not change vFcst_Invoices to 0 as it is supposed to.

Can you suggest how I can stop this problem

1 Reply
Miguel_Angel_Baeyens

I think that is dividing $(vFcstMonths) into null which causes an error. If you want to assign different values to vFcst_Invoices depending on the condition, you may try

LET vFcst_Invoices=if(isnull($(Invoice_Every)),0,round($(vFcstMonths)/$(vInvoiced_Every)));


So when $(Invoice_Every) gets a null value, vFcst_Invoices will take 0, otherwise, round value. Is that correct?