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

Loop to create table

Making a custom navigation table. How would I have a loop to create this?

 

let

        ColumnNames = Table.ColumnNames(DatabaseRecords(num)),

        objects = #table(
            {"Name",         "Key",   "Data",                                                    "ItemKind", "ItemName", "IsLeaf"},{

            {ColumnNames{0}, ColumnNames{0}, Table.Column(DatabaseRecords(num), ColumnNames{0}), "Table",    "Table",    true},
            {ColumnNames{1}, ColumnNames{1}, Table.Column(DatabaseRecords(num), ColumnNames{1}), "Table",    "Table",    true},
            {ColumnNames{2}, ColumnNames{2}, Table.Column(DatabaseRecords(num), ColumnNames{2}), "Table",    "Table",    true},
            {ColumnNames{3}, ColumnNames{3}, Table.Column(DatabaseRecords(num), ColumnNames{3}), "Table",    "Table",    true},
            {ColumnNames{4}, ColumnNames{4}, Table.Column(DatabaseRecords(num), ColumnNames{4}), "Table",    "Table",    true},
            {ColumnNames{5}, ColumnNames{5}, Table.Column(DatabaseRecords(num), ColumnNames{5}), "Table",    "Table",    true},

 

Right now its hard coded to iterate through. I want a loop that goes through 0-5 to create these. Do I utilize list.genertate? if so how?

2 REPLIES 2
v-rzhou-msft
Community Support
Community Support

Hi @JackSoderstrom 

Could you show me your DatabaseRecords(num) Table? Or you can share a easy sample which was got data by enter data. You can show me a screenshot that you the result you want. This will make it easier for me to know your requirement. 

Here is a Offical blog for List.Accumulate function.

For reference: List.Accumulate

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I think I have to use 

List.Accumulate({1, 2, 3, 4, 5}, 0, (state, current) => state + current),

But does it work with Tables?

 

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.