Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

SQL case into DAX Function 'SWITCH' does not support comparing values of type

I have convent SQL case into DAX 

it's showing that error can anyone guide what mistake I did

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.

 

Type = Var _Feature = CONTAINSSTRING(EODWQ[Reporting Segment Quantity],"Feature")

Var _Accessories = CONTAINSSTRING(EODWQ[Reporting Segment Dollars],"Accessory")

Var _VoiceAddALines = CONTAINSSTRING(EODWQ[Product Category],"'Business L3 & More") //|| CONTAINSSTRING(EODWQ[Product Category],"Family L3 & More") || CONTAINSSTRING(EODWQ[Product Category],"No Credit Check L3 & More")

Var _PrepaidActivations = CONTAINSSTRING( EODWQ[Product Category], "'Prepaid Voice") //|| CONTAINSSTRING( EODWQ[Product Category], "'Prepaid Mobile Internet")

Var _Equipment = CONTAINSSTRING( EODWQ[Product Category], "'Inventory : Equipment" )

var _BTSActs =  CONTAINSSTRINGEXACT( EODWQ[Product Category], "'Business") //|| CONTAINSSTRINGEXACT( EODWQ[Product Category], "'Individual / Family") || CONTAINSSTRINGEXACT( EODWQ[Product Category], "'No Credit Check")

Var _Voice_Activations =  CONTAINSSTRINGEXACT( EODWQ[Product Category], "'Business L1/L2") //|| CONTAINSSTRINGEXACT( EODWQ[Product Category], "'Family L1/L2") || CONTAINSSTRINGEXACT( EODWQ[Product Category], "'Individual") || CONTAINSSTRINGEXACT( EODWQ[Product Category], "'No Credit Check L1/L2") 
Var _Upgrade_term_type = CONTAINSSTRING(EODWQ[term type],"Upgrade")

Var _Null_term_type = CONTAINSSTRING(EODWQ[term type],"NULL")

Var _Equipment_term_type = CONTAINSSTRING(EODWQ[term type],"Equipment")

Var _Accessories_term_type = CONTAINSSTRING(EODWQ[term type],"Accessories")

Var _Feature_term_type = CONTAINSSTRING(EODWQ[term type],"Feature")

Var _Activation_term_type = CONTAINSSTRING(EODWQ[term type],"Activation")

Var _SprintMigration_term_type = CONTAINSSTRING(EODWQ[term type],"Sprint Migrations")

Var _PrepaidToPostpaid_term_type = CONTAINSSTRING(EODWQ[term type],"Prepaid to Postpaid")


Return

switch( true(),
	_Upgrade_term_type,
		switch( true(),
			_Feature ,"Features",
			_Accessories, "Accessories",
			_VoiceAddALines, "Upgrades",
			_PrepaidActivations, "Prepaid Activations",
			_Equipment, "Equipment","Upgrades"
			),
    _Activation_term_type,
        switch( true(),
			_Feature ,"Features",
			_Accessories, "Accessories",
			_VoiceAddALines, "Voice Add A Lines",
			_PrepaidActivations, "Prepaid Activations",
            _BTSActs,"BTS Activations",
            _Voice_Activations,"Voice Activations",
			_Equipment, "Equipment","Voice Activations"
			),
    _Equipment_term_type,"Equipment",
        switch( true(),
			_Feature ,"Features",
			_Accessories, "Accessories",
			_VoiceAddALines, "Voice Add A Lines",
			_PrepaidActivations, "Prepaid Activations",
            _BTSActs,"BTS Activations",
            _Voice_Activations,"Voice Activations",
			_Equipment, "Equipment","Equipment"
			),
    _Accessories_term_type,"Accessories",
        switch( true(),
			_Feature ,"Features",
			_Accessories, "Accessories",
			_VoiceAddALines, "Voice Add A Lines",
			_PrepaidActivations, "Prepaid Activations",
            _BTSActs,"BTS Activations",
            _Voice_Activations,"Voice Activations",
			_Equipment, "Equipment","Accessories"
			),
    _Feature_term_type,"Features",
        switch( true(),
			_Feature ,"Features",
			_Accessories, "Accessories",
			_VoiceAddALines, "Voice Add A Lines",
			_PrepaidActivations, "Prepaid Activations",
            _BTSActs,"BTS Activations",
            _Voice_Activations,"Voice Activations",
			_Equipment, "Equipment","Features"
			),
    _Null_term_type,
         switch( true(),
			_Feature ,"Features",
			_Accessories, "Accessories",
			_VoiceAddALines, "Voice Add A Lines",
			_PrepaidActivations, "Prepaid Activations",
            _Voice_Activations,"Voice Activations",
			"Equipment"
			)

)

 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@Anonymous not sure about this part of the switch statement

 

    _Equipment_term_type,"Equipment",
     
    _Accessories_term_type,"Accessories",
    


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

1 REPLY 1
parry2k
Super User
Super User

@Anonymous not sure about this part of the switch statement

 

    _Equipment_term_type,"Equipment",
     
    _Accessories_term_type,"Accessories",
    


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.