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: 
fmazzarelli
Partner - Creator III
Partner - Creator III

Assistance creating function

Hi Community


TotOre = Ore lavorate + Delta


If Delta = 0 then I obtain making the sum I have result (red color)


if the value is null, the sum is invalid (green color)


How to create a function?

,Immagine.png

9 Replies
maxgro
MVP
MVP

If I understand the question

sum(Ore lavorate) + sum(Delta)

fmazzarelli
Partner - Creator III
Partner - Creator III
Author

Hi,

Delta may assume 0 or null

If assume the value null, the sum is uncorrect

maxgro
MVP
MVP

what's the result (ore + delta) you want when delta is null?

ore          delta          result you want

null          2                ?

null          null            ?

0               null            ?

....

fmazzarelli
Partner - Creator III
Partner - Creator III
Author

ore          delta          result you want

null          2                2

null          null            0

0               null            0

kevincase
Creator II
Creator II

Fabio,

I believe you want to use the RangeSum() function.  This function will treat NULL values as 0.  Try:

RangeSum(Ore lavorate, Delta)

fmazzarelli
Partner - Creator III
Partner - Creator III
Author

Hi,

ok, it works.

Thanks

sfatoux72
Partner - Specialist
Partner - Specialist

RangeSum(Ore lavorate, Delta) works because you are on the lowest level.


But if you want aggregate your data (group by a dimension or display a Total), you will need to use :  RangeSum(sum(Ore lavorate), sum(Delta))

Anonymous
Not applicable

Hello Fabio,

I updated the title of this post. Please be sure to include a valid question in the title to make it easier for other members to assist you. Feel free to update this one if you need to.

Regards, Sara

sfatoux72
Partner - Specialist
Partner - Specialist

Hi Fabio,

if it works, mark an answer as correct to help other and close your request.

Best regards,