Hi. It sounds like a big query. Let's talk about some things.
The first thing you should know is that Power Bi sets default timeouts for conection and command. If the timing is higher than those the error is shown. You can change those values in the Source Step of the table in the "Transform Data" menu with Power Query. You can read about those parameters here: https://docs.microsoft.com/en-us/powerquery-m/sql-database
If you are using a Power Bi Pro or Free license you should know that the Power Bi Service won't handle any query with a command running more than 2 hours. The refresh will automatically fail even though the Desktop works the Cloud Service won't. So I won't recommend using more than 2 hours in the commandTimeout.
I suggest analyzing the queries and make them faster somehow (indexing, retriving lesss columns or rows, etc)
Hope that helps,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.