Forum Discussion

cerbertttt's avatar
cerbertttt
New Member
2 years ago
Solved

SWITCH Function with multiple hits for criteria

I recently started using Power BI a month ago. I'm currently trying to use SWITCH to sort through a column of text. The main problem that I am running into is that when a row has multiple words that ...
  • AlexisOlson's avatar
    2 years ago

    This should work as a calculated column:

    Ideal_Result = 
    VAR _Concat =
        CONCATENATEX (
            FILTER (
                { "cat", "dog", "fox" },
                CONTAINSSTRING ( 'SWITCH Test'[Raw Data], [Value] )
            ),
            [Value],
            ", "
        )
    VAR _Result =
        IF ( ISBLANK ( _Concat ), "Not Target", _Concat )
    RETURN
        _Result