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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Power Query Do While Loop

Hi,

 

I am trying to replicate a SQL do while loop.

 

I have a table with customers some are active some are inactive and I need to get the figures for each month end using the created and terminated dates.

 

In SQL I would set up a loop to do my calculation and add one month to the date in the loop to add the data to a temp table.

 

E.G. the example code would be if Customer was created prior to the month end and the termonation date is blank or greater than  the month they where active at the month end so include in the new table.

 

I have am having difficulty setting this up in Power Query so that the data from the data from the customer table is added to a new table and with each loop the next months data is appended to the table and so on  until teh max date is reached (the previous month end date).

 

I have looked at many eaxmples and they dont seem to do what I Need, if it can be done 

 

Any help would be greatly appreciated

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may check if the following post helps.

https://community.powerbi.com/t5/Desktop/Accumulate-sum-minus-abandoned/m-p/206947#M91174

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous ,

 

You may check if the following post helps.

https://community.powerbi.com/t5/Desktop/Accumulate-sum-minus-abandoned/m-p/206947#M91174

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you I'll take a look

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors