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

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.

Reply
Syndicate_Admin
Administrator
Administrator

Medida DAX con Variables y Switch

Buenas tardes,

Tengo una columna con los porcentajes sobre el total y tengo que relacionarla con unos porcentajes fijos para que en el columna Rank Oportunidades me salga un check o una cruz.

Por ejemplo:

En la fila 1. Detectado, el porcentaje óptimo es 2%, como 17% supera el porcentaje, está bien que ponga un check. Pero en cambio, en la fila 4. Negociación, el porcentaje óptimo es 18%, pero el valor es 15,53%, al no superarlo, tendría que salir una cruz, pero me pone el check igualmente.

mariases94_1-1636474841879.png

La medida que uso es esta:

Rank Oportunidades Razon para el estado =

DÓNDE COMPROBAR = "✔️"
DÓNDE CRUZ = ""
DEVOLUCIÓN

SI(HASONEVALUE(FactOpo[Razón para el estado]),

INTERRUPTOR(VERDADERO(),
[% Oportunidades Venta Nueva] >= 0.46, REPT(COMPROBAR,1),
[% Oportunidades Venta Nueva] >= 0.35, REPT(COMPROBAR,1),
[% Oportunidades Venta Nueva] >= 0.10, REPT(COMPROBAR,1),
[% Oportunidades Venta Nueva] >= 0.08, REPT(COMPROBAR,1),
[% Oportunidades Venta Nueva] >= 0.02, REPT(COMPROBAR,1),
REPT(CRUZ,1)), ESPACIO EN BLANCO()
)
No sé como arreglarla para que me devuelva la variable correcta.

Muchas gracias de antemano y un saludo,

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Rank Oportunidades Razon para el estado =
VAR CHECK = UNICHAR ( 10004 )
VAR CROSS = UNICHAR ( 10060 )
VAR Pct = [% Oportunidades Venta Nueva]
VAR Razon = SELECTEDVALUE ( FactOpo[Razón para el estado] )
RETURN
    SWITCH (
        TRUE (),
        Razon = "1. Detectado"   && Pct >= 0.46, CHECK,
        Razon = "2. Contactado"  && Pct >= 0.35, CHECK,
        Razon = "3. Evaluacion"  && Pct >= 0.10, CHECK,
        Razon = "4. Negociacion" && Pct >= 0.08, CHECK,
        Razon = "5. Cierre"      && Pct >= 0.02, CHECK,
        CROSS
    )

View solution in original post

1 REPLY 1
Syndicate_Admin
Administrator
Administrator

Rank Oportunidades Razon para el estado =
VAR CHECK = UNICHAR ( 10004 )
VAR CROSS = UNICHAR ( 10060 )
VAR Pct = [% Oportunidades Venta Nueva]
VAR Razon = SELECTEDVALUE ( FactOpo[Razón para el estado] )
RETURN
    SWITCH (
        TRUE (),
        Razon = "1. Detectado"   && Pct >= 0.46, CHECK,
        Razon = "2. Contactado"  && Pct >= 0.35, CHECK,
        Razon = "3. Evaluacion"  && Pct >= 0.10, CHECK,
        Razon = "4. Negociacion" && Pct >= 0.08, CHECK,
        Razon = "5. Cierre"      && Pct >= 0.02, CHECK,
        CROSS
    )

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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