@Chewbacca I am guessing you have TSQL code to connect and get data from SQL Server. If yes then why don't you use power bi default connector for SQL Server which lets you type in your TSQL code and query. That will also generate power query code for you automatically by using default connector.
I cannot use the TSQL code and connect to the SQL server, because the code is from another SQL server, and I have made a query in Power Query that includes the data that I need. So I need to make a new query from that table.
What specific data do you want to get with the new query? You can review the following blog and article to get details about that how to retrieve or transfer SQL Server data with Power Query Formula Language.