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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
Anonymous
Not applicable

Caso SQL en la función DAX 'SWITCH' no admite la comparación de valores de tipo

Tengo caso de convento SQL en DAX

está mostrando que el error puede alguien guiar qué error hice

La función 'SWITCH' no admite la comparación de valores de tipo True/False con valores de tipo Text. Considere la posibilidad de utilizar la función VALUE o FORMAT para convertir uno de los valores.

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

@M_OVAISJANZEB no está seguro acerca de esta parte de la instrucción switch

    _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

@M_OVAISJANZEB no está seguro acerca de esta parte de la instrucción switch

    _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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors