It has been a long time that I use SQL Server Profiler to diagnose my data models in the Power BI Desktop. I wrote a blog post in June 2016 about connecting to the underlying Power BI Desktop model from different tools, including SQL Server Management Studio (SSMS), Excel and SQL Server Profiler. In this quick post, I share a pbitool.json file that you can use to register the SQL Server Profiler as an external tool. Read more about how to register an external tool here. This is quite handy as this way to use SQL Server Profiler to diagnose Power BI Desktop without needing to find the diagnostic port. As an external tool, the SQL Server Profiler automatically connects to the data model via the diagnostic port. You can download the sqlserverprofiler.pbitool.json file from here. After you download the file you can open it in a text editor to see or modify the JSON code. If you are using SSMS 18, then you do not even need to modify the file. If you use a different version, the only thing you have to change is the “path”.
Continue reading “Quick Tips: Registering SQL Server Profiler as an External Tool in Power BI Desktop”I have written 3 blogposts about query parameters in the past.
- Power BI Desktop Query Parameters, Part 1, Introduction
- Power BI Desktop Query Parameters, Part2, Dynamic Data Masking and Query Parameters
- Power BI Desktop Query Parameters, Part 3, List Output
This is the fourth one in the form of Quick Tips. Here is the scenario. One of my customers had a requirement to get data from a Stored Procedure from SQL Server. She required to pass the values from a Query Parameter back to SQL Server and get the results in Power BI.
The solution is somewhat easy. I created a simple stored procedure in AdventureWorksDW2019 as below:
CREATE PROCEDURE SP_Sales_by_Date
@date int
AS
BEGIN
SET NOCOUNT ON;
SELECT *
FROM [dbo].[FactInternetSales]
WHERE OrderDateKey >= @date
END
GO
In Power BI Desktop, get data from SQL Server, then:
- Enter Server name
- Enter Database name
- Select Data Connectivity Mode
- Expand the Advanced options
- Type in a SQL statement to call the stored procedure like below:
exec SP_Sales_by_Date @date = 20140101
- Click OK
- Click Transform Data
Now we need to create a Query Parameter. In my sample I create a DateKey in Decimal Number data type:
Continue reading “Quick Tips, Power BI Desktop, Query Parameters, Part 4, Passing Power Query Parameter Values to SQL Server Stored Procedures”