Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
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
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 6 | |
| 6 |