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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Iterate over web pages using multiple inputs

Hi,

 

I have a demo model, iterating over multiple webpages, combining them to one, by adding nested tables for each page 1, 2, 3... etc. This was working great until recently, when the owner of the webpage decided to cap the returned values to 99 pages, regardless of the search parameters. However there are multiple filter options, one of them being alphabetical, so I need to expand my existing function with another dynamic value in the url, to contain both "page" and "letter", and then expand the each function of the recieving table to allow for both page and letter. Lets try to break it down a bit.

 

so this is the function url, I added a static letter "A" as an example:

 

let
    GameRankings = (page as number) as table =>
let
    Source = Web.Page(Web.Contents("http://www.gamerankings.com/browse.html?page=" & Number.ToText(page) & "&numrev=2&" & "letter=" & "A")),
    Data0 = Source{0}[Data]
in
    #"Data0"
in 
    GameRankings

The code for the recieving table (GameRankings) then looks like this:

 

let
    Source = InputTable,
    #"Tilføjet brugerdefineret" = Table.AddColumn(Source, "GR", each GR_PageFx([Page])),
    #"Expanded GR" = Table.ExpandTableColumn(#"Tilføjet brugerdefineret", "GR", {"Column1", "Column2", "Column3", "Column4"}, {"GR.Column1", "GR.Column2", "GR.Column3", "GR.Column4"})
in 
#"Expanded GR"

 

The "InputTable" is a table I entered manually in power BI containing all combinations of Pages (0-99) and Letters (#-Z).

 

So with my limited M skills I assume that at least the following adjustments need to be made:

 

- Function: "letter=" & "A" part needs to be made dynamic

- The "= Table.AddColumn(Source, "GR", each GR_PageFx([Page]))," part of the GameRankings / receiving table needs to take into account the second column of my InputTable, containing the letters, to receive each combination of letters and pages...

 

But how, is my question?

 

Hope someone can help me make the necessary adjustments to the code above.

 

//Rasmus

 

Edit: Please let me know if I should add further description or material.

0 REPLIES 0

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.