Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Calculated column looking up for specifc data

Good day all,

 

Hope someone can help me with the following

As you can see, Box A is linked to 2 types of sales (W & P) and 2 customers (1 & 2)

I want to add a calculated column. 

The formula must look for de customer, based on sales type P

So, the combination 'Box A' and 'Sales W' should give 'Customer 2' as a result

Is this possible?

 

Thanks, John

 

Customer              Box          Sales       Column

1                            A             W            2

2                            A             P             2

1                            B             W            2 

2                            B             P             2

  • Hi Anonymous,

     

    Column =
    VAR Customer = test[adres_cod]
    VAR BOX = test[container_nr]
    VAR Sales = "PTI&OFFH"
    RETURN
        CALCULATE (
            FIRSTNONBLANK ( test[adres_cod], 1 ),
            test[container_nr] = BOX,
            test[occ_act_group] = Sales,
            ALL ( test )
        )

    Best regards,

    Yuliana Gu

10 Replies

  • Hello,

     

    try this:

    =VAR Customer=Table[Customer]
    VAR BOX=Table[Box]
    VAR Sales="P"
    Return CALCULATE(VALUES(Table[Customer]);Table[Box]=BOX;Table[Sales]=Sales;ALL(Table[Customer]))
    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Floriankx,

       

      Seems to work fine!

       

      Thanks a lot.

       

      JOhn

      • Anonymous's avatar
        Anonymous
        Not applicable

        I have an additional question Florian,

         

        Can you 'describe' the formula for me?

        Because, if I read the formula, I do not really understand who it works.

         

        Thanks,

         

        John