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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
PWRBI
Frequent Visitor

Loop for getting Data from database

Hi,

 

I need to load a very large amount of data from a database, when I load a whole month the server times out. Therefore I would like to load every single day via a loop.

But what would such a loop look like? Do you have an example?

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @PWRBI 

 

What is the database you are connecting to? For some databases, you can expand Advanced options and enter another value for command timeout to keep the connection open longer when querying data. 

vjingzhang_0-1658304073339.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

BA_Pete
Super User
Super User

Hi @PWRBI ,

 

I'm not sure this will work as you expect it will. Even if you apply a functional loop, or staged load, the server connection is going to remain open for the duration of the query refresh and, therefore, will likely be shut down by the server as before.

For this quantity of data, you should really be looking at using Direct Query and Aggregation tables:

https://dax.tips/2021/09/06/intro-to-power-bi-aggregations/ 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors