'SWITCH Statement Using VALUE or FORMAT function to convert one of the values

I am getting this error when I try to create a measure in Power BI:

Function SWITCH does not support comparing values of type True/False with values of type Text. Consider using the VALUE or FORMAT function to convert one of the values.

I am unable to fix this from my end

Here is the DAX measure I am creating:

SWITCH (
    SELECTEDVALUE ( 'vw_OA_dashboard_SSL_Region'[SSL_Abbr] ),
    AND ("Audit", [Company_Filtered] = 1 ), SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ),
    AND ("BTS", [Company_Filtered] = 1 ), SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ),
    AND ("C&G", [Company_Filtered] = 1 ), SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ),
    AND ("CYBER", [Company_Filtered] = 1 ), SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ),
    AND ("EY-P", [Company_Filtered] = 1 ), SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ),
    " "
)```


Solution 1:[1]

Try this:

IF ([Company_Filtered] = 1, SWITCH ( SELECTEDVALUE ( 'vw_OA_dashboard_SSL_Region'[SSL_Abbr] ), "Audit", SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ), "BTS", SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ), "C&G", SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ), "CYBER", SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ), "EY-P", SUM ( vw_OA_dashboard_SSL_Region[open_opportunities] ), "" ), "")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SamBouKoa