Calculating the % of a pivot index group

Hello! I am trying to do:

  1. Calculate the sum of column 1, 2 and 3
  2. Take nulls into account
  3. Calculate column 1 as a % of the sum (step 1) 

I have managed steps 1 and 2 but am falling at the divide stage…

Steps one and two:

coalesce(pivot_index(${orders.orders_count},1),0)+ coalesce(pivot_index(${orders.orders_count},2),0)+ coalesce(pivot_index(${orders.orders_count},3
    ),0)

When I try to add divide on the front it fails...

coalesce(pivot_index(${orders.orders_count},1),0)/
coalesce(pivot_index(${orders.orders_count},1),0)+ coalesce(pivot_index(${orders.orders_count},2),0)+ coalesce(pivot_index(${orders.orders_count},3
    ),0)

Any ideas would be very much appreciated!

Thank you community!

0 0 238
0 REPLIES 0
Top Labels in this Space
Top Solution Authors