Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sindhura
Contributor II
Contributor II

Adding Two fields with one of them is Null

I have two fields Tax and Credit.

Credit = Tax + Original Price.

But for some of fields, I have Tax fields as Null.

so I should get Credit =  Original Price.

but i see Null in the report for this field as well.

I have used the expression Tax + Original Price

Calculated dimension is also giving me the same result : Num (([Tax]+[Original Price]), '#,##0.00')

Can anyone please help me

1 Solution

Accepted Solutions
sunny_talwar

Although Peter's solution is the best possible, but just for a sake of an alternative you can also do this:

Alt(Tax, 0) + Alt([Original Price], 0)

View solution in original post

5 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

Use RangeSum(Tax, [Original Price])

RangeSum will add individual values and treat NULL values as 0.

Best,

Peter

sunny_talwar

Although Peter's solution is the best possible, but just for a sake of an alternative you can also do this:

Alt(Tax, 0) + Alt([Original Price], 0)

jagan
Luminary Alumni
Luminary Alumni

Hi,

While loading your data in script try to handle this using Alt() or Len(Trim()) like below, handling this in Front end is not a good idea.

Data:

LOAD

*,

Alt(Tax, 0) AS Tax_New

FROM DataSource;

OR

Data:

LOAD

*,

If(Len(Trim(Tax)) = 0, 0, Tax) AS Tax_New

FROM DataSource;

Now use Tax_New in the charts.


Hope this helps you.


Regards,

Jagan.

sindhura
Contributor II
Contributor II
Author

All the scenarios worked.

Thanks a lot

jagan
Luminary Alumni
Luminary Alumni

Hi,

If you got the answer please close this thread by giving correct Answer to the post which helps you.

Regards,

Jagan.