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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.