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 amigos, tengo una columna donde son años de nacimiento de los usuarios, pero también hay valores nulos. Necesito hacer una condición donde necesito encontrar si el usuario es "mayor de 50 años", "younder 50 años" o "no se puede calcular" debido al valor nulo. Intenté algo como esto:
Solved! Go to Solution.
Hola
Tratar
Older or younger 50 years =
Switch ( True();
2020 - 'Data 2015, 2016'[birth year] > 50; "More then 50 years";
ISBLANK('Data 2015, 2016'[birth year]); "Cant calculate";
2020 - 'Data 2015, 2016'[birth year] < 50; "Younger 50 years")
o, si el campo devuelve null como texto:
Older or younger 50 years =
Switch ( True();
2020 - 'Data 2015, 2016'[birth year] > 50; "More then 50 years";
'Data 2015, 2016'[birth year] = "null"; "Cant calculate";
2020 - 'Data 2015, 2016'[birth year] < 50; "Younger 50 years")
Hola, @leenka
Si toma la respuesta de alguien, márquela como la solución para ayudar a los otros miembros que tienen los mismos problemas a encontrarlo más rápidamente. Si no, avísame y trataré de ayudarte más. Gracias.
Saludos
Allan
Hola, @leenka
Según su descripción, creé datos para reproducir su escenario.
Mesa:
Puede probar las siguientes columnas calculadas.
Older or younger 50 years =
SWITCH(
TRUE(),
'Table'[Age]>=50,"More than 50 years",
'Table'[Age]<50&&'Table'[Age]>0,"Younger than 50 years",
'Table'[Age]=BLANK(),"Cant calculate",
BLANK()
)
or
Older or younger 50 years 2 =
IF(
'Table'[Age]>=50,
"More then 50 years",
IF(
'Table'[Age]>0&&'Table'[Age]<50,
"Younger than 50 years",
IF(
'Table'[Age]=BLANK(),
"Cant calculate",
BLANK()
)
)
)
Resultado:
Saludos
Allan
Si este post ayuda,entonces por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
@leenka
Prueba esto
Older or younger 50 years =
var age= 2020- 'Data 2015'[birth year]
var result = IF(ISBLANK('Data 2015'[birth year]),"Cant calculate",IF(age>50,"Greater","less"))
return result
Hola
Tratar
Older or younger 50 years =
Switch ( True();
2020 - 'Data 2015, 2016'[birth year] > 50; "More then 50 years";
ISBLANK('Data 2015, 2016'[birth year]); "Cant calculate";
2020 - 'Data 2015, 2016'[birth year] < 50; "Younger 50 years")
o, si el campo devuelve null como texto:
Older or younger 50 years =
Switch ( True();
2020 - 'Data 2015, 2016'[birth year] > 50; "More then 50 years";
'Data 2015, 2016'[birth year] = "null"; "Cant calculate";
2020 - 'Data 2015, 2016'[birth year] < 50; "Younger 50 years")
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 | |
1 | |
1 | |
1 | |
1 |