Forum Discussion

StoryofData's avatar
StoryofData
Helper III
3 years ago
Solved

SWITCH FUNCTION

I am trying to use SWITCH, it seems to be working but when the column is not summarized but when I do a count then it counts BLANKS, what am I doing wrong?  Column 2 = SWITCH( TRUE (), 'Table...
  • BrianConnelly's avatar
    BrianConnelly
    3 years ago

    I think the issue is after the last condition then.  Switch has a default if no conditions are true, e.g.

    SWITCH(TRUE()
    ,Test, Result
    ,Test, Result
    ,Default)

     

    Change your code to the following:

    SWITCH (
    TRUE (),
    'Table'[EmplId] = BLANK (), BLANK (),
    'Table'[IssueSub Formatted] = BLANK (), BLANK (),
    'Table'[City] = "Not Applicable", BLANK (),
    'Table'[City] = "Not Disclosed", BLANK (),
    'Table'[IssueSub Formatted] = "Referral/Redirect", BLANK (),
    'Table'[Title Categorized] = "Former Employee", BLANK (),
    'Table'[EmplId] <> BLANK ()
    ,COMBINEVALUES (" - ", [CaseNumber], [EmplId]))

     

    Let me know if that fixed it.  I removed the =TRUE()