venugopal
venugopal

Reputation: 89

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] ),
    " "
)```

Upvotes: 0

Views: 3083

Answers (1)

SamBouKoa
SamBouKoa

Reputation: 206

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] ), "" ), "")

Upvotes: 1

Related Questions