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
NewinPBi
Frequent Visitor

Cómo mostrar varias condiciones verdaderas

Hola, soy nuevo en PBi y luchando con múltiples pantalla de condición VERDADERO

Mi mesa

Nombre Edad Sexo Tipo Provincia DxYear

Andy 24 M 2 12 2003

Lisa 45 F 3 13 2004

Alcance 55 M 1 14 2005

Quiero agregar una nueva columna "Edits" y quiero mostrar información como un grupo en esta columna en función de las condiciones

Ediciones ?

Edit1 IF (NOT('Tumours'[province]-10),"Edit1",

Edit2 IF('Tumours'[tipo ] á 1), "Edit2",

Edit3 IF('Tumours'[DxYear] < 2004", "Edit3",

"Sin edición" )))

Quiero una exhibición final como esta

Nombre Edad Sexo Tipo Provincia DxYear Ediciones

Andy 24 M 2 12 2003 Edit1

Edit2

Edit3

Lisa 45 F 3 10 2002 Edit3

Hany 55 M 1 14 2005 Edit1

Edit2

Si uso la instrucción IF, Power Bi solo comprueba la condición First TRUE, pero un registro puede tener varias condiciones TRUE y quiero mostrar todas las condiciones TRUE en un grupo.

¿Hay bucle en PowerBi? Cualquier ayuda sería apreciada

1 ACCEPTED SOLUTION
Alexander76877
Helper II
Helper II

Hola, los bucles se llaman "iteradores".

NecesitaS CONCATENATEX.

Cree una tabla de ejemplo utilizando
Tabla: GENERATESERIES(1, 10, 1)
Cambiar el nombre de la columna "valor" por "nr".
Cree una columna "editar" utilizando
Editar ??
CONCATENAR(
GENERATESERIES(1, 3, 1),
SWITCH([Valor],
1, IF('Table'[Nr]-5, "Edit1
"),
2, IF('Table'[Nr]>2, "Edit2
"),
3, IF('Table'[Nr]<8, "Edit3
"), BLANK()
)
)
Haga un objeto visual de tabla que muestre "nr" (no resumir) y "editar".
Ese es el resultado que querías.
Alexander

View solution in original post

2 REPLIES 2
Alexander76877
Helper II
Helper II

Hola, los bucles se llaman "iteradores".

NecesitaS CONCATENATEX.

Cree una tabla de ejemplo utilizando
Tabla: GENERATESERIES(1, 10, 1)
Cambiar el nombre de la columna "valor" por "nr".
Cree una columna "editar" utilizando
Editar ??
CONCATENAR(
GENERATESERIES(1, 3, 1),
SWITCH([Valor],
1, IF('Table'[Nr]-5, "Edit1
"),
2, IF('Table'[Nr]>2, "Edit2
"),
3, IF('Table'[Nr]<8, "Edit3
"), BLANK()
)
)
Haga un objeto visual de tabla que muestre "nr" (no resumir) y "editar".
Ese es el resultado que querías.
Alexander
v-jayw-msft
Community Support
Community Support

Hola @NewinPBi ,

Puede hacerlo en el Editor de consultas mediante la característica Agregar columna condicional y Columnas despivot.

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcsxLqVTSUTIyARK+IAYQG4IIIwMDY6VYnWgln8ziRCDfxBRIuAGxMUiFMUSFCViFR2JeIsgQU1OoIYYgbAJRYqoUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Age = _t, Sex = _t, Type = _t, Province = _t, DxYear = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Age", Int64.Type}, {"Sex", type text}, {"Type", Int64.Type}, {"Province", Int64.Type}, {"DxYear", Int64.Type}}),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type",13,10,Replacer.ReplaceValue,{"Province"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",2004,2002,Replacer.ReplaceValue,{"DxYear"}),
    #"Added Custom" = Table.AddColumn(#"Replaced Value1", "Custom", each if [Province] <> 10 then "edit1" else null),
    #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each if [Type] = 1 then "edit2" else null),
    #"Added Conditional Column" = Table.AddColumn(#"Added Custom1", "Custom.2", each if [DxYear] < 2004 then "edit3" else null),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Added Conditional Column", {"Name", "Age", "Sex", "Type", "Province", "DxYear"}, "Attribute", "Value"),
    #"Removed Columns" = Table.RemoveColumns(#"Unpivoted Columns",{"Attribute"})
in
    #"Removed Columns"

4.PNG

Pbix como unido.

Saludos

Jay

Equipo de apoyo a la comunidad _ Jay Wang

Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.