cancel
Showing results for
Did you mean:
Frequent Visitor

## Iterating trough items with steps of 500 items

Hi,

i am in a situation where i need to create a loop

for example i know i have 2579 items now i want to have a table autogenerated because the number can also be 3200 or more.

in the table there should be 0,500,1000,1500,2000 2500 as when i devide 2579 with 500 it is 5 times. in case of 3200 i need to iterate 6 times 500.

Now i need this in a table as i need the values somewhere else.

does somebody have a solution for this.

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

## Re: Iterating trough items with steps of 500 items

@PaulKeijzers

You can reference a calculated table as below.

```Number Table =
FILTER (
SELECTCOLUMNS (
FILTER (
CALENDAR ( "1970-01-01", "2020-12-31" ),
"daysSince 1970-01-01", DATEDIFF ( "1970-01-01", [Date], DAY )
),
MOD ( [daysSince 1970-01-01], 500 ) = 0
),
"num", [daysSince 1970-01-01]
),
//[num] <= COUNTROWS ( YourTable )
[num] <=2579
)```

4 REPLIES 4
Moderator

## Re: Iterating trough items with steps of 500 items

@PaulKeijzers

You can reference a calculated table as below.

```Number Table =
FILTER (
SELECTCOLUMNS (
FILTER (
CALENDAR ( "1970-01-01", "2020-12-31" ),
"daysSince 1970-01-01", DATEDIFF ( "1970-01-01", [Date], DAY )
),
MOD ( [daysSince 1970-01-01], 500 ) = 0
),
"num", [daysSince 1970-01-01]
),
//[num] <= COUNTROWS ( YourTable )
[num] <=2579
)```

Frequent Visitor

## Re: Iterating trough items with steps of 500 items

Somehow youre code did not work yet maybe i am missing something.

i have a clean table so no columns etc.

Moderator

## Re: Iterating trough items with steps of 500 items

@PaulKeijzers

What do you mean "doesn't work"? Any error?

Check the calculated table in the attached pbix.

Frequent Visitor

## Re: Iterating trough items with steps of 500 items

Hi Eric,

i need it in the query editor this is done in the front and somehow it does not work as a query in the advanced editor.

Paul

Announcements

#### Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

#### Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

#### Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 133 members 1,754 guests
Recent signins: