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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lborget
Regular Visitor

List.Generate and iterate dynamic thrue all pagenumbers

Hello, I have a problem with my Power Query.
Hopefully someone can help me with this?

 

The function (FunctionData) is working correctly for every page i fill in as parameter, but now i want a total list of all available pages. I want to iterate dynamic thrue all pagenumbers, like: https://example.com/test/page=1

But a major drawback is every page give a response back (is available), so i create a big loop with a lot of tables without content, only null values. I can remove all the tables with null values, but i think that's not the best practise.

 

Thanks!

 

Let

    DataList = List.Generate( ()=>

 

[Result= try FunctionData(1) otherwise null, Page =1],

each [Result] <> null,

each [Result= try FunctionData(Page) otherwise null, Page = [Page] +1],

    each [Result]),

    #"Geconverteerd naar tabel" = Table.FromList(DataList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),

    #"Lege rijen verwijderd" = Table.SelectRows(#"Geconverteerd naar tabel", each not List.IsEmpty(List.RemoveMatchingItems(Record.FieldValues(_), {"", null})))

in

    #"Lege rijen verwijderd"

1 REPLY 1
v-shex-msft
Community Support
Community Support

HI @lborget,

In fact, Microsoft already shared some sample codes of specific scenarios in 'helper functions for M extensions'. You can take a look at on it if any sample code meets your requirement.

Helper Functions 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.