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
Anonymous
Not applicable

Cómo agregar la condición de texto en Switch

Dd

Hola: necesito agregar otra condición a esta instrucción, pero no estoy seguro de cómo.
Tengo que añadir: allopps-products[status]-"open" como una de las condiciones. Pero no me deja.
¿Qué debo hacer para poder agregar esta afección?
INTERRUPTOR (
TRUE(),
MAX('AllOpps-Products'[Prob.]) a 80, "30 días",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 90, "Older than 90",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 60, "Older than than 60",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 30, "Older than than 30",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 15, "30 Days",
Falso
)
3 REPLIES 3
amitchandak
Super User
Super User

@texmexdragon , no está muy claro dónde desea utilizar eso. Pero revisa un par de opciones

if(max(allopps-products[status])="open",
SWITCH(
    TRUE(),
    MAX('AllOpps-Products'[Prob.]) = 80, "30 Days",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 90, "Older than 90",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 60, "Older than 60",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 30, "Older than 30",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 15, "30 Days",
    FALSE
),blank())


SWITCH(
    TRUE(),
    MAX('AllOpps-Products'[Prob.]) = 80 && max(allopps-products[status])="open", "30 Days",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 90, "Older than 90",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 60, "Older than 60",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 30, "Older than 30",
    DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 15, "30 Days",
    FALSE
)

Anonymous
Not applicable

@amitchandak (o cualquier persona que pueda responder)

La solución de Amit es genial, con una excepción.

¿Cómo lidiar con una fecha que está en el pasado? Ejemplo:

La fecha de cierre estimada puede ser de hecho 15 días o más a partir de la fecha de hoy.... pero podrían ser 15 días en el pasado a partir de hoy (no 15 días a partir de hoy). Para aquellas fechas de cierre estimadas que ya han pasado (a partir de la fecha actual de hoy), ¿cómo abordar en la instrucción Switch?

harshnathani
Community Champion
Community Champion

Puede agregar allopps-products[status]-"open" usando && notation
INTERRUPTOR (
TRUE(),
MAX('AllOpps-Products'[Prob.]) á 80 && allopps-products[status]-"open" , "30 Days",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 90, "Older than 90",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 60, "Older than than 60",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 30, "Older than than 30",
DATEDIFF(MAX('AllOpps-Products'[Est.Ship]),TODAY(),DAY)> 15, "30 Days",
)

saludos
Harsh Nathani

¿Respondí a tu pregunta? ¡Marca mi puesto como solución! Apreciar con un Kudos!! (Haga clic en el botón Pulgarhacia arriba)

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.