Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Conditional column based on two other columns

Hi.

 

I have these two columns where I would like to return a value of a third value. If parent ID also exist in the "id" column then I would like to know the "sagstype" value of that one in a seperat column. How do I do that? 🙂

 

 

 

6 Replies

  • Anonymous ,

     

    new column = 

    var _count = countx(filter(Table, Table[ID] = earlier(Table[Parent ID]) ), Table[ID])

    return

    if(not(isblank(_count)) , "sagstype", blank())

    • Anonymous's avatar
      Anonymous
      Not applicable

      amitchandak 
      I dont want the text "Sagstype" - I want the value in the "sagstype" column 🙂
      "Sagstype" is the third column in the image. 

       

      Also something is missing. Some of the "Parent ID" I can't find in the "id" column 🙂

  • Arul's avatar
    Arul
    Super User

    Anonymous ,

    try this in calculated column,

    Type Matching = 
    VAR _distinctId = VALUES('Table'[id])
    VAR _result = IF('Table '[Parent ID] IN _distinctId,'Table'[Sagstype],BLANK())
    RETURN _result

    Thanks,

    Arul

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Arul 
      Unfortunately it does not work correctly. It just returns the same value as in the same row. 

       

      I tried to illustrate it in the image below: 
      Out from id is the "sagstype" incident and the parent ID is the "sagstype" reguest for change. And I want the "request for change" returned in the calculated column not incident 🙂

       

       

  • Is this what you are looking for?

    • Anonymous's avatar
      Anonymous
      Not applicable

      Yes, thank you! It works perfectly!