Forum Discussion

KPME's avatar
KPME
New Member
3 years ago
Solved

Alter value based on other columns

Hello everyone,

 

basically I have a table that is the below.

The "FILTERED_SCORE" is what I'm trying to achieve.

Basically: FILTERED_SCORE = "Score" unless Issue1, Issue 2 or Issue 3 are not blank, then it's 0

 

IDScoreIssue1Issue2Issue3FILTERED_SCORE
100110   10
100120Reason1  0
100120   20
100210 Reason3 0
100210   10
100220  Reason20
  • KPME ,

    You can use the SWITCH function in combination with OR:

    Filtered_Score1 = SWITCH(
                        TRUE(),
                     OR( [Issue3]<> BLANK(), OR( [Issue1] <> BLANK(), [Issue2] <> BLANK() )), 0,
                     [Score] )

    The "Or" function only accepts 2 arguements, so I nested them together to capture all 3 Issue columns.

    IDScoreIssue1Issue2Issue3FILTERED_SCOREFiltered_Score1

    1001 10       10 10
    1001 20 Reason1     0 0
    1001 20       20 20
    1002 10   Reason3   0 0
    1002 10       10 10
    1002 20     Reason2 0 0

    Regards,

2 Replies

  • rsbin's avatar
    rsbin
    Icon for Community Champion rankCommunity Champion

    KPME ,

    You can use the SWITCH function in combination with OR:

    Filtered_Score1 = SWITCH(
                        TRUE(),
                     OR( [Issue3]<> BLANK(), OR( [Issue1] <> BLANK(), [Issue2] <> BLANK() )), 0,
                     [Score] )

    The "Or" function only accepts 2 arguements, so I nested them together to capture all 3 Issue columns.

    IDScoreIssue1Issue2Issue3FILTERED_SCOREFiltered_Score1

    1001 10       10 10
    1001 20 Reason1     0 0
    1001 20       20 20
    1002 10   Reason3   0 0
    1002 10       10 10
    1002 20     Reason2 0 0

    Regards,

    • KPME's avatar
      KPME
      New Member

      You're the best! worked like a charm 😄