Incorrect percentage if there are null values

Hi everyone!
I’m new to your community. I use ElasticSearch as a source.

I have two amounts(one amount is the required share of the total amount)

  • Task : to withdraw the percentage of this amount from the total amount

  • Expectation : 3.59

  • Reality : 4.07

  • Complexity : In the first field, where the fraction of the sum is, there are null values, and the math expresion doesn’t process the query and outputs NaN, with the help of reduce I tried to simple drop the null values or replace them with a value mapping, but the percentage is still incorrect.

  • What I need : to take one amount divided by another, multiply by 100 and get the correct percentage, because if u get a percentage of the amounts ( in the first screenshot) then it comes out correct.

Help, please :pray:t4:

You can try the filter data by values transformation, and exclude any null values.

1 Like

Thanks for the answer! :pray:t4:

I found a solution: I reduced all the values in each field to a single sum through reduce, and i worked like with just amount.

image

I hope this can be useful for somebody :crossed_fingers:t4:
That was the solution for my problem!

1 Like