Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi Expertos
Quiero hacer lo siguiente como un if o Switch en una columna calculada...
La declaración del problema que tiene requiere que compruebe si hay un rango en lugar de comprobar si es mayor que un número determinado. Un número como 14 resultará "Menor de 18 años", pero dado que su segunda condición es >18, cualquier cosa que sea más de 18 (25, 53, 73, 79) estatizará esa condición y obtendrá "18+". El resto de las condiciones en su código nunca se verificarán.
Debe escribir el código para verificar los rangos de esta manera:
Category = SWITCH(TRUE,
'Table'[Values]<18, "Under 18",
'Table'[Values]>=18 && 'Table'[Values]<52, "18+",
'Table'[Values]>=52 && 'Table'[Values]<72, "52+",
'Table'[Values]>=72 && 'Table'[Values]<78, "72+")
Resultado:
¿Respondí a su pregunta? ¡Marque esta publicación como una solución si lo hiciera!
Pruebe esta columna calculada:
CalculatedColumn =
SWITCH (
TRUE,
RTT[Actual_Weeks_Waiting] >= 78, "78+",
RTT[Actual_Weeks_Waiting] >= 72, "72+",
RTT[Actual_Weeks_Waiting] >= 52, "52+",
RTT[Actual_Weeks_Waiting] >= 18, "18+",
RTT[Actual_Weeks_Waiting] < 18, "Under 18",
BLANK ()
)
¿Podría arrojar algo de luz sobre lo siguiente?
enlace: https://community.powerbi.com/t5/Desktop/Switch-Measure-error/m-p/2825247#M976120
Hola, incluso con eso corregido, todavía no devuelve el resultado correcto
Excelente señor trabajado.......
Me alegra saber que funcionó. Por cierto, puede eliminar el argumento BLANK() ya que devolverá BLANK si no se cumple ninguna de las condiciones.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.