Skip to main content
Question

Sum distinct values

  • October 20, 2021
  • 4 replies
  • 38 views

I want to sum only distinct values. And here´s my problem. I created a variable with the order and the position of the order (CONCAT VKBEL & POS). And now I want to SUM the amount of the order quantity of all variables. But the variable occurs more than once. Is there a function that only sum distinct values? Thanks in advance for any ideas.

4 replies

  • Author
  • Level 1
  • October 20, 2021

or is there a possibility to filter out the variable that occurs more than once?


lucas.van.d12
Level 5
Forum|alt.badge.img+7

Hi Silvia,

 

I think this could be a solution:

SUM(PU_FIRST(DOMAIN_TABLE(VKBEL. POS),VALUE)) , you might need to e.g. use a MAX or an ORDER BY to get the right value as I don't know your exact situation.

 

Does that help? Good luck,

Lucas


  • Author
  • Level 1
  • November 10, 2021

Dear Lucas, thank you so much for your fast reply. I found a solution for my problem. I have aggregated my data on the wrong table. Now I use the VBAP and pull the data from the VBFA to the VBAP that I don´t need the variable anymore and create only one line per case.

Unfortunatly the Domain_Table function did not work in my case (maybe I didn´t use it properly) so I have to find this other way.

 

Regards,

 

Silvia


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

Hi Silvia,

 

I believe you are now aggregating directly in the case level (VBAP), so something like

PU_COUNT(VBAP,VBFA.RFMNG_FLO)

 

But if you want to aggregate to the Sales Order Level, you can use the DOMAIN_TABLE. This function creates a virtual table and is commonly use when the tables are not directly connected.

Alternatively, you can also check the BIND() function that has a similar functionality

celonis.cloud/help/display/CIBC/BIND

Best,

Gabriel