Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I need get the data to power bi using SQl functions
Is there any way to do this?
Thanks
Solved! Go to Solution.
hi @KavyaReddy
Yes you should be able to get data from SQL function ,
I did a test and I was able to get data from SQL function
following in the test function i have created
and i was able to pull data using that function using the SQL server database get data connector
Hi ,
Yes, you can get data into Power BI using SQL functions by connecting Power BI to your database and using SQL queries (including functions) in your data import process. Here's how you can do it:
Open Power BI Desktop.
Click on Home > Get Data > SQL Server (or another database type like MySQL, PostgreSQL, etc., depending on your data source).
Enter the server name and database details, and select DirectQuery or Import mode.
After connecting, you can choose to run a SQL query to get your data.
Instead of selecting tables directly, click on Advanced options and enter your SQL query with any functions you want to use.
Example:
SELECT
MyColumn,
dbo.MySQLFunction(MyColumn) AS FunctionResult
FROM dbo.MyTable
You can also use stored procedures or views in your SQL query to encapsulate the SQL functions, allowing you to run complex logic before pulling the data into Power BI.
When connecting, instead of selecting a table, you can execute a stored procedure that returns the data you need.
If the solution works for you, accept it as the solution. Let me know if you need any further help!
Hi ,
Yes, you can get data into Power BI using SQL functions by connecting Power BI to your database and using SQL queries (including functions) in your data import process. Here's how you can do it:
Open Power BI Desktop.
Click on Home > Get Data > SQL Server (or another database type like MySQL, PostgreSQL, etc., depending on your data source).
Enter the server name and database details, and select DirectQuery or Import mode.
After connecting, you can choose to run a SQL query to get your data.
Instead of selecting tables directly, click on Advanced options and enter your SQL query with any functions you want to use.
Example:
SELECT
MyColumn,
dbo.MySQLFunction(MyColumn) AS FunctionResult
FROM dbo.MyTable
You can also use stored procedures or views in your SQL query to encapsulate the SQL functions, allowing you to run complex logic before pulling the data into Power BI.
When connecting, instead of selecting a table, you can execute a stored procedure that returns the data you need.
If the solution works for you, accept it as the solution. Let me know if you need any further help!
hi @KavyaReddy
Yes you should be able to get data from SQL function ,
I did a test and I was able to get data from SQL function
following in the test function i have created
and i was able to pull data using that function using the SQL server database get data connector
Please provide a more detailed explanation of what you are aiming to achieve. What have you tried and where are you stuck?
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 57 | |
| 43 | |
| 41 | |
| 22 | |
| 17 |
| User | Count |
|---|---|
| 183 | |
| 114 | |
| 93 | |
| 62 | |
| 45 |