cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PaulKeijzers
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.

 

thanks in advance.

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft
Microsoft

@PaulKeijzers

 

You can reference a calculated table as below.

 

Number Table = 
FILTER (
    SELECTCOLUMNS (
        FILTER (
            ADDCOLUMNS (
                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
)

Capture.PNG

 

View solution in original post

4 REPLIES 4
Eric_Zhang
Microsoft
Microsoft

@PaulKeijzers

 

You can reference a calculated table as below.

 

Number Table = 
FILTER (
    SELECTCOLUMNS (
        FILTER (
            ADDCOLUMNS (
                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
)

Capture.PNG

 

View solution in original post

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

i have a clean table so no columns etc.

 

@PaulKeijzers

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

Check the calculated table in the attached pbix.

 

 

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.

 

thanks in advance,

 

Paul

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

MBAS on Demand

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Get Ready for Power BI Dev Camp

Microsoft named a Leader in The Forrester Wave

Microsoft received the highest score of any vendor in both the strategy and current offering categories.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Top Solution Authors
Top Kudoed Authors