Create dynamic reports for individual values

 To create a dynamic report, you first need to write your SQL query. Then use the Get data feature in Power BI Desktop to connect to the database.

In this example, you connect to your database on SQL Server by following these steps:

  1. After you have entered your server details, in the SQL Server database window, select Advanced options.

  2. Paste the SQL query into the SQL statement box and then select OKWhen the connection is made, the data is shown in the preview window.

  3. Select Edit to open the data in Power Query Editor.

Next, you create the parameter by following these steps:

  1. On the Home tab, select Manage parameters > New parameter.

  2. On the Parameters window, change the default parameter name to something more descriptive so that its purpose is clear. In this case, you change the name to SalesPerson.

  3. Select Text from the Type list and then select Any value from the Suggested value list.

  4. Select OK. A new query is shown for the parameter that you created.

Now, you need to adjust the code in SQL query to assess your new parameter:

  1. Right-click Query1 and then select Advanced editor.

  2. Replace the existing value in the execute statement with an ampersand (&) followed by your parameter name (SalesPerson), as illustrated in the following image.

  3. Make sure that no errors are shown at bottom of the window and then select Done.

Though you don't see a difference on the screen, Power BI ran the query.

  1. To confirm that the query was run, you can run a test by selecting the parameter query and entering a new value in the Current Value box.

  2. A warning icon might display next to the query. If so, select that query to view the warning message, which states that permission is required to run this native database query. Select Edit Permission and then select Run. When the query runs successfully, the parameter displays the new value.

  3. Select Close and Apply to return to the report editor.

Now, you can apply the parameter to the report:

  1. Select Edit queries > Edit parameters.

  2. On the Edit Parameters window, enter a new value and then select OK.

  3. Select Apply changes and then run the native query again.

    Now, when you view the data, you see the data for the new value that was passed through the parameter.

You can now create a report that displays data for one particular value at a time. More steps are needed to display data for multiple values at the same time.


Comments

Popular posts from this blog

Azure built-in roles for tables

Explore Dataflows Gen2 in Microsoft Fabric

Select and configure an appropriate method for access to Azure Blobs