Good Practice: Always Display the Reporting Environment

While you work on real-world tasks in energy BI, you’ll most likely have totally different environments Like DEV, UAT, Pre-Prod and Prod. It can be crucial for you and your viewers to know what the info is coming from. Am I taking a look at Dev or UAT knowledge or I’m truly taking a look at actual knowledge in Manufacturing atmosphere. You’ll have requested or been requested with a query like “The place the info is coming from?”. You will need to understand how reliable the info you’re analysing is. On this publish I present you a simple solution to present the atmosphere your Energy BI report is related to.

How It Works

To show the atmosphere title you employ question parameters, you then reference that parameter, flip it to a desk and add columns to indicate the environments accordingly. Straightforward proper?

Read more about query parameters from a list output here.

Relying in your state of affairs the implementation could be barely totally different, however the principals are the identical. On this publish I take advantage of a SQL server database. Subsequently I must Parameterise server title. in actual world you may additionally must parameterise the database title. Once more, in case your case is kind of totally different, like in case you get knowledge from Excel, then the Excel path could be totally different for various environments. Let’s dig-in.

  • Open Question Editor
  • Click on “Handle Parameters”
  • Click on “New”
    • Enter “Title” and “description”
    • Tick “Required”
    • Choose “Textual content” in “Kind”
    • Choose “Checklist of values” in “Recommended Values” and sort in server names for various environments
    • choose a “Default Worth” and “Present Worth”
    • Click on OK
Creating new parameter in Power BI Query Editor

Up to now you created a brand new parameter that can be utilized to get knowledge from a SQL Server knowledge supply.The subsequent steps present you easy methods to use that parameter to indicate the environments in your studies.

  • Proper click on on the “Servers” parameter and choose “Reference”
Referencing query parameters in Power BI Query Editor
  • This creates a brand new question referencing the parameter’s “Present Worth”
  • Rename the question to Environments
Current Value of a Query Parameter in Power BI Desktop
  • Click on “To Desk” button from “Convert” part from the ribbon
Convert Query Parameter value to table in Power BI
  • Rename the “Column1” column to “Server”
  • from “Add Column” tab from the ribbon click on “Customized Column”
  • Kind in a reputation for the brand new column
  • within the components kind one thing the next (the components could be totally different in your case)
if [Server] = ".SQL2017" then "" else if [Server] = ".SQL2019" then "UAT" else "Dev"
  • Click on OK
Add a new custom column to the query in Power BI Query Editor

I don’t wish to present something after I change to manufacturing server so I put “null” for my manufacturing server.

We’re virtually accomplished. The one remaining piece of the puzzle could be making use of the adjustments and put the atmosphere in a Card visible in our report.

  • Click on “Shut & Apply” from “Residence” tab from the ribbon
Apply changes to the query in Query Editor in Power BI
  • Now put a Card visible on the report canvas
  • Choose “Atmosphere” column
  • Disable “Class Label” from the Card

All accomplished!

Using Card Visual in Power BI Desktop

Now let’s check it.

  • From “Edit Queries” button from “Residence” tab click on “Edit Parameters”
Edit prarameters' values in Power BI Desktop
  • Change parameter worth by deciding on a distinct worth from the checklist
  • Click on OK
Switch parameter value by selecting a different value in Power BI Desktop
  • Click on “Apply Modifications”
Applying changes when editing query parameter value in Power BI Desktop

There we go. It’s working completely.

Changing query parameters value in Power BI Desktop

Here’s a screenshot of a report constructed with the identical method that clearly exhibits the atmosphere the report is related to. After I choose a manufacturing server then the cardboard exhibits nothing so it’s could be invisible in manufacturing atmosphere whereas in different environments it’s fairly clear which atmosphere my report is related to.

Displaying Environment in Power BI

Have you ever ever used this method? Have you ever confronted any challenges? Have you ever accomplished it in a different way? Please share with us your ideas within the remark part under.



Source link