cancel
Showing results for
Did you mean:
Visitor

## obtaining a result based on a conditional sum in the same column

Hello community, I need help to obtain a result based on a conditional SUM in the same column. I don't which is the easiest way, creating  "custom column" or a measure.

I've the following table,

| DOCUMENT# | PRODUCT_STEP |

| 1234            |      1                       |
| 1234            |      4                       |

| 1234            |      8                       |

What I want to create is a new column or measure to obtain a new result:

If "Document#" SUMS "5" then, "Product X", Otherwise, Product_step.

RESULT:

| DOCUMENT# | PRODUCT_STEP |  PRODUCT TYPE

| 1234            |      1                      |    Product X
| 1234            |      4                      |    Product X

| 1234            |      8                      |    8

The "document#" are mostly uniques but each of one of them can pass trough 2 or 3 "Product_steps", not that often but it can,  and if it does, then it becomes in a diff type of product, which is what I need to identify creating a new column or measure.

I know that with this formula I'll have duplicates, but I cansimply divide the total outcome in 2 to have the exact number. Or if you can suggest a better way to do it, I'm all ears (eyes)

Important note: My tables are from a server, thus, I can't edit the structure that much.

Thanks a lot!!

Community Support Team

## Re: obtaining a result based on a conditional sum in the same column

Hi @AlejoRivera,

In this scenario, you should create custom column to get the desired result. As in a measure, it is not possible to compare each item (DOCUMENT#) of one column with a specific value (Sums) insde IF function and return multiple values that can generate a column. The expected logic only applies to calculated column.

Regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.