Hi Wajahat Ali,
Thank you for reaching out on the Microsoft Q&A forum.
To connect a SQL Server database to Power BI and generate reports, open Power BI Desktop and select “Get Data” from the Home ribbon, then choose “SQL Server” as your data source. Enter the server name and, if applicable, the database name. You can choose between “Import” mode, which loads the data into Power BI for faster performance, or “DirectQuery” mode, which queries the data live from SQL Server. Kindly refer to the screenshot below for guidance.
After connecting, you can either select the required tables or write a custom SQL query to pull specific data. Once the data is loaded, you can begin creating your visual reports.
If you are still facing any issue, please let us know in the comments and where you are encountering this error along with the screenshot for reference. We are glad to help you.
Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.
Thank you.