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

Error de ruta: cada valor de [COMPONENTS] debe tener el mismo valor en [PARENT]

Hola

Estoy intentando crear una columna calculada usando la función PATH: Path = PATH(COMPONENTS, PARENT). Recibo el error "Cada valor en [COMPONENTS] debe tener el mismo valor en [PARENT]. El valor '001:1200035:RS3016-007' tiene varios valores".

¿Algún consejo sobre cómo resolver este problema?

ID DEL SITIOFIN DEL ARTÍCULOPADRECOMPONENTESRUTA DE SALIDA DESEADA
0011200035 12000351200035
0011200035120003512035MARCO051200035/12035MARCO05
001120003512035MARCO058312035051200035/12035FRAME05/831203505
001120003583120350512035R-51200035/12035FRAME05/831203505/12035R-5
001120003583120350512035R1-21200035/12035FRAME05/831203505/12035R1-2
001120003512035R1-2RS3016-0071200035/12035FRAME05/831203505/12035R1-2/RS3016-007
001120003512035R-5RS3016-0071200035/12035FRAME05/831203505/12035R-5/RS3016-007
4 REPLIES 4
Syndicate_Admin
Administrator
Administrator

@kk1791 , Los dos últimos registros tienen el mismo componente pero un padre diferente, que puede el problema

Gracias por la respuesta. Mi pregunta es cuando hay varios padres para los componentes, ¿cómo crear una ruta? ¿Alguna otra opción para superar esto?

@kk1791 ,

Parece que no hay una buena solución para manejarlo. El método posible es "eliminar" el valor duplicado del campo [COMPONENTS] para evitar este error... Creé un archivo pbix de muestra (ver archivo adjunto) para usted, verifique si eso es lo que desea. Puede seguir los pasos a continuación para obtenerlo:

1. Agregar nueva columna personalizada en el Editor de Power Query

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjAwVNJRMjQyMDAwNsXKitUhoMrY1C3I0dfVAKdShAIdJQtjsAAOxQhZqMYgXWIVGuoa4bYfLKujFBRsbGBopmtgYI5Hqa4pmspYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"SITE ID" = _t, #"END ITEM" = _t, PARENT = _t, COMPONENTS = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"SITE ID", type text}, {"END ITEM", type text}, {"PARENT", type text}, {"COMPONENTS", type text}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"COMPONENTS"}, {{"Count", each Table.RowCount(_), Int64.Type},{"Index", each Table.AddIndexColumn(_, "Index",1,1), type table}})//{{"Count", each Table.RowCount(_), Int64.Type},{"Index", each Table.AddIndexColumn(_, "Index",1,1)}, {"Details", each _, type table [SITE ID=nullable text, END ITEM=nullable text, PARENT=nullable text, COMPONENTS=nullable text]}})
,
    #"Expanded Index" = Table.ExpandTableColumn(#"Grouped Rows", "Index", {"SITE ID", "END ITEM", "PARENT", "Index"}, {"SITE ID", "END ITEM", "PARENT", "Index"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Index", "NewComponents", each if [Count]>1 then [COMPONENTS]&"_"&Text.From([Index]) else [COMPONENTS]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Count", "Index"})
in
    #"Removed Columns"

yingyinr_0-1660901136446.png

2. Cree una columna calculada como la siguiente para obtener la ruta

Column = PATH('Site'[NewComponents],'Site'[PARENT])

yingyinr_1-1660901233158.png

Saludos

Probé su solución y funcionó perfectamente. Gracias por ello. Pero cuando intento ejecutar para todas las ubicaciones para el mismo elemento final, recibo este error: el valor '35SHRINK2' en 'BOM' [PARENT] también debe existir en 'BOM' [NewComponents]. Agregue los datos que faltan e inténtelo de nuevo.

¿Podría guiarme sobre qué debo hacer para solucionar este problema?

Adjunto el enlace de datos como referencia: https://docs.google.com/spreadsheets/d/1Gzziln2BShPoVpeZm-ohKkcj_ctkPUBO/edit?usp=sharing&ouid=11116...

Gracias de antemano

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.