Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Anonymous
Not applicable

Cada uno, enumerar las transformaciones y escribir el error de acceso al campo de texto

Tratando de destilar mi problema tanto como sea posible:

Tengo una serie de registros, a partir de los cuales quiero crear una tabla con varias columnas, cada columna que llama a una función diferente con el registro como argumento.

let
    Repos = Table.FromRecords({
    [CustomerName = "Bob"],
    [CustomerName = "Jim"],
    [CustomerName = "Alice"],
    [CustomerName = "Paula"]
}),
     subItems = Table.ToList(Repos),
    objects = List.Transform(subItems, each 
    Table.FromRecords({[Name = [CustomerName], Key = Text.Combine({"Key for ", [CustomerName]}), Data = Text.Combine({"Data for ",[CustomerName]}), ItemKind = "Table", ItemName = "Table", IsLeaf = true]} ))
in
    objects

Esto me da lo que inicialmente parece ser correcto:

image.png

Sin embargo, al expansión me

image.png

Error de expansión da

Expression.Error: No podemos aplicar acceso de campo al tipo Texto.
Detalles:
Valor-Bob
Clave-Nombre_cliente

¿Algún puntero o idealmente una documentación con más ejemplos?

Gracias de antemano,

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Al final era más fácil tomar la tabla inicial y agregar columnas (Table.AddColumn...) usando como columnGenerator un each (algo) que llamaba a las funciones relevantes.

En otras palabras, el siguiente código

let
    Repos = Table.FromRecords({
    [CustomerName = "Bob"],
    [CustomerName = "Jim"],
    [CustomerName = "Alice"],
    [CustomerName = "Paula"]
}),
    ReposWithKey = Table.AddColumn(Repos,"Key", each Text.Combine({"Key for ", [CustomerName]})),
    ReposWithData = Table.AddColumn(ReposWithKey, "Data", each Text.Combine({"Data for ",[CustomerName]})),
    ReposWithItemKind = Table.AddColumn(ReposWithData, "ItemKind", each "Table"),
    ReposWithItemName = Table.AddColumn(ReposWithItemKind, "ItemName", each "Table"),
    ReposWithLeaf = Table.AddColumn(ReposWithItemName, "isLeaf", each "true")
in
    ReposWithLeaf

hizo el truco

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Al final era más fácil tomar la tabla inicial y agregar columnas (Table.AddColumn...) usando como columnGenerator un each (algo) que llamaba a las funciones relevantes.

En otras palabras, el siguiente código

let
    Repos = Table.FromRecords({
    [CustomerName = "Bob"],
    [CustomerName = "Jim"],
    [CustomerName = "Alice"],
    [CustomerName = "Paula"]
}),
    ReposWithKey = Table.AddColumn(Repos,"Key", each Text.Combine({"Key for ", [CustomerName]})),
    ReposWithData = Table.AddColumn(ReposWithKey, "Data", each Text.Combine({"Data for ",[CustomerName]})),
    ReposWithItemKind = Table.AddColumn(ReposWithData, "ItemKind", each "Table"),
    ReposWithItemName = Table.AddColumn(ReposWithItemKind, "ItemName", each "Table"),
    ReposWithLeaf = Table.AddColumn(ReposWithItemName, "isLeaf", each "true")
in
    ReposWithLeaf

hizo el truco

v-xicai
Community Support
Community Support

Hola @whiskas1983 ,

Puede consultar los enlaces:

https://community.powerbi.com/t5/Desktop/quot-Expression-Error-We-cannot-apply-field-access-to-the-t...

https://community.powerbi.com/t5/Desktop/We-cannot-apply-field-access-to-the-type-List/td-p/851856

https://community.powerbi.com/t5/Power-Query/Expression-Error-We-cannot-apply-field-access-to-the-ty...

Saludos

Amy

Equipo de apoyo a la comunidad _ Amy

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

lbendlin
Super User
Super User

¿Cuál es tu razón para no empezar con una lista?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors