Skip to main content
Question

SUM unique table column values

  • November 17, 2020
  • 2 replies
  • 14 views

Hello ALL, I am working on pulling sum of values from a particular table column in Celonis using PQL. I try to the sum of distinct values of the table column. However, when I do SUM(Table.Amount) it is giving me sum of all the values in the column and not the unique ones. I want to get the 30000000 + 7500000 = 37500000. How to sum the unique colunm values? thank you.

2 replies

gabriel.okaba11
Celonaut
Forum|alt.badge.img+2

Hi Jia,

there is no such function SUM(DISTINCT) as in SQL , but you can probably achieve your result by using a DOMAIN TABLE

Assuming you want only unique values for a certain column (i.e. unique values for a certain plant)

the formula should look like

 

PU_SUM(DOMAIN_TABLE(table.PLANTcolumn),Table.Amount)

 

Best,

Gabe

 


  • Level 0
  • November 25, 2021

This seems like you are getting duplicate values? Maybe a solution would be to deduplicate the data beforehand and then using the regular SUM() functionality. You could also do this within the Event Collection of Celonis, if you are interested in doing this let me know an we can provide a script for you.

 

Best,

Kevin