Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hola a todos,
He creado la función de caso SQL que quiero convento en DAX, ¿alguien puede ayudarme.
case
when
{custbody_vm_term_type} like '%Upgrade%'
then
case
when
{class.cseg_reporting_seg2} like'%Feature%'
then
'Features'
when
{class.cseg_reporting_seg1} like '%Accessory%'
then
'Accessories'
when
{item} like '%ADD%'
OR {item} like '%AAL%'
then
'Voice Add A Lines'
when
(
{class} like '%Sales : Rate Plans : Prepaid%'
or {class} like '%Sales : Features : Prepaid%'
)
then
'Prepaid Activations'
when
{class} like '%Inventory : Equipment%'
then
'Equipment'
else
'Upgrades'
end
when
{custbody_vm_term_type} like '%Activation%'
then
case
when
(
{class} like '%Sales : Rate Plans : Prepaid%'
or {class} like '%Sales : Features : Prepaid%'
)
then
'Prepaid Activations'
when
{class.cseg_reporting_seg2} like '%Feature%'
then
'Features'
when
{class.cseg_reporting_seg2} like '%BTS Acts%'
then
'BTS Activations'
when
{class.cseg_reporting_seg1} like '%Accessory%'
then
'Accessories'
when
{item} like '%ADD%'
OR {item} like '%AAL%'
then
'Voice Add A Lines'
When
{class} like '%Inventory : Equipment%'
Then
'Equipment'
else
'Voice Activations'
end
when
{custbody_vm_term_type} like '%Equipment%'
then
'Equipment'
when
{custbody_vm_term_type} like '%Accessories%'
then
'Accessories'
when
{custbody_vm_term_type} like '%Feature%'
then
'Features'
when
{custbody_vm_term_type} is NULL
then
Case
when
{class.cseg_reporting_seg2} like '%Feature%'
then
'Features'
when
{class.cseg_reporting_seg1} like '%Accessory%'
then
'Accessories'
when
{Class} like '%Sales : Rate Plans : Postpaid : Postpaid AAL%'
then
'Voice Add A Lines'
when
(
{class} like '%Sales : Rate Plans : Prepaid%'
or {class} like '%Sales : Features : Prepaid%'
)
then
'Prepaid Activations'
when
{class} like '%Sales : Rate Plans : Postpaid : Postpaid%'
then
'Voice Activations'
else
'Equipment'
end
else
'Equipment'
end
Hola , @M_OVAISJANZEB
La sintaxis SQL'caso... Cuando.. Entonces.. Cuando.. entonces ' corresponde a la sintaxis de Dax 'Switch'
La sintaxisSQL' LIKE'%SQLBI%' corresponde a la sintaxis Dax 'Containsstring' / 'SEARCH'
Puede comprobar si estos documentos ayudan.
from-sql-to-dax-string-comparison
dax/containsstring-function-dax
Saludos
Equipo de soporte de la comunidad _ Eason
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hey @M_OVAISJANZEB ,
si desea crear una columna calculada, utilice SWITCH(...) asegúrese de almacenar en caché las referencias de columna en variables como esta:
column name =
var __columnname1 = 'tablename'[columnname]
...
return
SWITCH(
TRUE()
, FIND("Upgrade" , __columnname1 , 1 , BLANK())
, SWITCH(
...
)
,
)
Con suerte, esto proporciona lo que está buscando.
saludos
Tom
@M_OVAISJANZEB puede utilizar la función switch para aplicar la misma instrucción case, algo como esto
New Column =
SWTCIH ( TRUE(),
Table[Column] = "ABC", "Return value",
Table[Column] = "XYZ", "Return value"
)
y también puede tener un conmutador anidado.
Me gustaría❤ elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!
⚡Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.⚡
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |