Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

fmazzarelli
Contributor 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
MVP
MVP

Re: if

If I understand the question

sum(Ore lavorate) + sum(Delta)

fmazzarelli
Contributor III

Re: if

Hi,

Delta may assume 0 or null

If assume the value null, the sum is uncorrect

MVP
MVP

Re: if

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

ore          delta          result you want

null          2                ?

null          null            ?

0               null            ?

....

fmazzarelli
Contributor III

Re: if

ore          delta          result you want

null          2                2

null          null            0

0               null            0

kevincase
Contributor II

Re: if

Fabio,

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

RangeSum(Ore lavorate, Delta)

fmazzarelli
Contributor III

Re: if

Hi,

ok, it works.

Thanks

sfatoux72
Valued Contributor

Re: if

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))

sli
Valued Contributor II

Re: Assistance creating function

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
Valued Contributor

Re: if

Hi Fabio,

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

Best regards,

Community Browser