How to use SQL Server stored procedures in Microsoft PowerBI?

AsafSavich picture AsafSavich · Jun 2, 2016 · Viewed 42.1k times · Source

I want to generate reports from my SQL Server tables.

I have some already made stored procedures that I would like to use to generate reports from.

I haven't found a way to do so.

Only by rewriting the queries.

Thanks :)

Answer

Radhieka picture Radhieka · Jul 22, 2016

To execute your SP in Power BI-->

1.In SQL Server right click on your SP and select Execute. Your code is executed and a new query window opens up which was responsible for execution. Copy that Query.

2.In Power BI Query Editor, select New Source-->SQL Server. After giving the server and database, in the same window click on "Advanced Options", paste the query in the "SQL Statement" that opened up. Check "Navigate using full hierarchy" and click OK.

3.You will see data for the parameters you passed in SP only.

  1. On Applying these changes, you will see the dataset for this in Power BI Desktop from where you can create reports.

NOTE: This works in"Import Query" option.

Hope this works for you as it did for me, Cheers!