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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
MattBatt
New Member

Column with Tables, m code function problem

Hello.
I have a problem. I want to extract information from the table into one cell. And I have errors like in this picture. The aim is to create a dynamic function to use in the column function Could you help? My primitive code is below. Thanks for your help. 🙂

Zrzut ekranu 2022-08-18 192954.pngZrzut ekranu 2022-08-18 194455.png

 

 

 

 

 

 

(mytable as table)=>

let
#"Transform File (6)" = #"mytable"{0}[#"Transform File (6)"],
#"Demoted Headers" = Table.DemoteHeaders(#"Transform File (6)"),
#"Filtered Rows" = Table.SelectRows(#"Demoted Headers", each Text.Contains([Column1], "2c Podtrzymywanie oddychania")),
#"Counted Rows" = Table.RowCount(#"Filtered Rows")
in
#"Counted Rows"

 

 

 

 

 

1 ACCEPTED SOLUTION
MattBatt
New Member

I found solution: 

(mytable as table)=> 
 
    let
     Source = Excel.Workbook(mytable, null, true),
     #"Demoted Headers" = Table.DemoteHeaders(mytable),
    #"Changed Type" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each #"Changed Type"{0}[Column1]),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each Text.Contains([Column1], "2a Wentylacja mechaniczna - 5 pkt. Wszystkie ")),
    #"Counted Rows" = Table.RowCount(#"Filtered Rows")
in
    #"Counted Rows"

View solution in original post

3 REPLIES 3
MattBatt
New Member

I found solution: 

(mytable as table)=> 
 
    let
     Source = Excel.Workbook(mytable, null, true),
     #"Demoted Headers" = Table.DemoteHeaders(mytable),
    #"Changed Type" = Table.TransformColumnTypes(#"Demoted Headers",{{"Column1", type text}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each #"Changed Type"{0}[Column1]),
    #"Filtered Rows" = Table.SelectRows(#"Added Custom", each Text.Contains([Column1], "2a Wentylacja mechaniczna - 5 pkt. Wszystkie ")),
    #"Counted Rows" = Table.RowCount(#"Filtered Rows")
in
    #"Counted Rows"
MattBatt
New Member

For Example: 

My aim is to extract one specific cell from each table in the column "Transform File (6)".
In the Column "Transform File" in the picture show this one specific cell value (instead of an error).

Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @MattBatt - It is not clear what you are trying to achive from the information provided.  I am not sure you have a valid function.  I would not expect this line to work 

#"Demoted Headers" = Table.DemoteHeaders(#"Transform File (6)")

 because you have selected a String or Number in the previous step instead of a table.

Can you step out an example in Excel or upload an example PBIX file.

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors