Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more
Hello!
I want to grab data from the WEB page and make a function (to change adress Source = Web.BrowserContents("https://www.biznesradar.pl/raporty-finansowe-rachunek-zyskow-i-strat/KERNEL,Q") ) from the query, but I have a problem with the step (#"Extracted Table From Html"), because a number of columns can be different, for example sometimes it can be 10, sometimes 30, etc.
{"Column14", "TABLE.report-table > * > TR > :nth-child(14)"}
How to make this part dynamic?
let
Source = Web.BrowserContents("https://www.biznesradar.pl/raporty-finansowe-rachunek-zyskow-i-strat/KERNEL,Q"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.report-table > * > TR > :nth-child(1)"},
{"Column2", "TABLE.report-table > * > TR > :nth-child(2)"}, {"Column3", "TABLE.report-table > * > TR > :nth-child(3)"},
{"Column4", "TABLE.report-table > * > TR > :nth-child(4)"}, {"Column5", "TABLE.report-table > * > TR > :nth-child(5)"},
{"Column6", "TABLE.report-table > * > TR > :nth-child(6)"}, {"Column7", "TABLE.report-table > * > TR > :nth-child(7)"},
{"Column8", "TABLE.report-table > * > TR > :nth-child(8)"}, {"Column9", "TABLE.report-table > * > TR > :nth-child(9)"},
{"Column10", "TABLE.report-table > * > TR > :nth-child(10)"}, {"Column11", "TABLE.report-table > * > TR > :nth-child(11)"},
{"Column12", "TABLE.report-table > * > TR > :nth-child(12)"}, {"Column13", "TABLE.report-table > * > TR > :nth-child(13)"},
{"Column14", "TABLE.report-table > * > TR > :nth-child(14)"}, {"Column15", "TABLE.report-table > * > TR > :nth-child(15)"}},
[RowSelector="TABLE.report-table > * > TR"]),
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {""}, "Attribute", "Value"),
#"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> ""))
in
#"Filtered Rows"
The main problem that I don`t know how many columns should be.
Hi @IvanRy ,
that would look like so:
(myNumber as text) =>
let Source = Web.BrowserContents("https://www.biznesradar.pl/raporty-finansowe-rachunek-zyskow-i-strat/KERNEL,Q"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "TABLE.report-table > * > TR > :nth-child(1)"}, {"Column2", "TABLE.report-table > * > TR > :nth-child(2)"}, {"Column3", "TABLE.report-table > * > TR > :nth-child(3)"}, {"Column4", "TABLE.report-table > * > TR > :nth-child(4)"}, {"Column5", "TABLE.report-table > * > TR > :nth-child(5)"}, {"Column6", "TABLE.report-table > * > TR > :nth-child(6)"}, {"Column7", "TABLE.report-table > * > TR > :nth-child(7)"}, {"Column8", "TABLE.report-table > * > TR > :nth-child(8)"}, {"Column9", "TABLE.report-table > * > TR > :nth-child(9)"}, {"Column10", "TABLE.report-table > * > TR > :nth-child(10)"}, {"Column11", "TABLE.report-table > * > TR > :nth-child(11)"}, {"Column12", "TABLE.report-table > * > TR > :nth-child(12)"}, {"Column13", "TABLE.report-table > * > TR > :nth-child(13)"}, {"Column" & myNumber, "TABLE.report-table > * > TR > :nth-child(" & myNumber & ")"}, {"Column15", "TABLE.report-table > * > TR > :nth-child(15)"}}, [RowSelector="TABLE.report-table > * > TR"]),
#"Promoted Headers" = Table.PromoteHeaders(#"Extracted Table From Html", [PromoteAllScalars=true]), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Promoted Headers", {""}, "Attribute", "Value"), #"Filtered Rows" = Table.SelectRows(#"Unpivoted Other Columns", each ([Value] <> ""))
in #"Filtered Rows"
Just keep in mind that this would probably prevent a refresh in the service, because it's going to be considered as a dynamic data source.
Imke Feldmann (The BIccountant)
If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!
How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.