Saturday, January 13, 2024

Lesson 45 - Python Visual in Power BI Desktop

Power BI supports Python integration, allowing users to import data, perform advanced data transformations, build machine learning models, and create custom visualizations using Python libraries such as pandas and matplotlib.

In this blog, we'll learn how to import data using Python scripts and create Python visuals in Power BI Desktop. Below shows simple scatter chart for showing correlation between fields using Python visual in Power BI


How to Proceed?


Importing dataset using Python script

We can run python script directly in Power BI desktop to import a dataset for analysis. we can share those reports to power BI service
  • Check the python script in local python environment and make sure the code works and gives the required output.
  • Python script with user prompt code stops the code execution.
  • Python scripts are subject to execution time and resource limits. Long-running scripts may time out.
  • Python script for loading a basic data frame works.

In Power BI desktop Home page, click on Get data and choose “Python Script” from multiple data sources and press connect.


Paste the python script and click ok.


Once the code runs successfully, a navigator window appears and ask for load data. Click on load data.


Now u can see the “Sample Python” dataset get loaded into Power BI.

















Creating chart using Python visual in Power BI

Step 1

Launch power BI desktop app and open the new report page and import the data required.


Step 2

In “visualizations” pane click on “Python Visual” which is highlighted in the given figure.

Prerequisites

You need to install Python on your local machine. 


To use Python with Power BI, install the required packages such as pandas, matplotlib, and numpy.

Pandas – data analysis tool, to work on python visual python data must be in pandas data frame
Matplotlib- Library for creating visualization in python
Install these two packages in console or shell, prefix pip command to install the packages









Enable Python Scripting

To enable python scripting in power BI, click on File->Options and settings->Options->Python Scripting. In the Python scripting option page give local python installation path. Click ok.  

Step 3

Drag the data fields into Build visual pane to analyze.  

Based on the fields selected for analyze python editor by default create a data frame named dataset.
Power BI automatically creates a pandas DataFrame named dataset containing the selected fields. By default, the selected fields use the Don't summarize aggregation where applicable.


Step 4 Create visual

Here I created a basic scatter chart using python code which shows correlation between age and weight.
Write python code and click Run to generate the chart.


Python visuals have limited formatting options in Power BI. Most visual customization must be done within the Python script.


Step 5 Save the visual

Finally, your Python Visual is ready. Click save button to save the visual.










When to use Python Visual?

Python visual in power BI can be used when built in visuals in Power BI does not meet your needs, we can use python visual for creating custom visuals. Also, for doing advance analytics and for predicting using machine learning model.

Pros
  • Python visuals allows high level of customization in visuals.
  • Advanced analytics and machine learning capabilities
  • Many pre-built python packages and visualizations are available which we can make use for our needs.
  • Can do complex data transformations
Cons
  • Coding knowledge is must work on python visual.
  • Large datasets and complex scripts may affect performance.
  • Requires installation and proper configuration of python is needed


Conclusion


Python visuals in Power BI must be used based on the level of customization user needs and complex level of analysis. It is not suitable for all scenarios where we need to evaluate whether built in power BI visuals are sufficient for our needs.

Useful Information


Tags Power BI
Useful links https://realpython.com/power-bi-python/
MS Learn Modules
Test Your Knowledge Quiz

Friday, January 12, 2024

Lesson 44 - Paginated Reports in Power BI Desktop

To use the Paginated Report visual, you must be signed in to the Power BI Service. Paginated reports are created and edited using Power BI Report Builder, then published to a workspace in the Power BI Service where they can be embedded into Power BI reports.

To create a Paginated report visual, you must be signed into the Power BI Service. Paginated reports are created and edited in Power BI Report Builder, then published to the Power BI Service for viewing and embedding in reports.

Power BI Report Builder can be downloaded from the official Microsoft Download Center. (Download Microsoft® Power BI Report Builder from Official Microsoft Download Center)



How to Proceed?

Step 1

In “visualizations” pane click on “Paginated Report” which is highlighted in the given figure. 













Step 2


When you click on the Paginated report visual it will ask for Power BI Service log in, once u logged in “Embed a Paginated report” will get displayed. Select Connect to report to browse and embed an existing paginated report published to the Power BI Service.

Step 3

In this example, I have already published the Olympic Events semantic model to my Fabric workspace. Use the published semantic model to create the paginated report in Power BI Report Builder.


Step 4

Create the paginated report in Power BI Report Builder, save it, and publish it to your Power BI workspace.


Step 5 Design your Paginated Report

Simply Drag and drop the required fields for paginated report. we can also add filters here as we do in power BI desktop. Here I included Report only for athletes who secured medal hence filtered No medal from Medal field.



Step 6 Formatting the Header


We can format the Paginated Report header with different style formats. Finally save the paginated report in workspace











Step 7 Embedding a paginated report from Power BI

Select the published paginated report to embed it into your Power BI report.


Click on the saved Paginated report to view the report in Power BI.


Turn On the Toolbar Setting in Format visual pane of this Paginated Report Visual. We can show or hide the Toolbar and Customize the Toolbar position in the Paginated Report visual.



From the toolbar report readers can easily export the paginated report by clicking Export option from the tool pane. Paginated report supports exporting to different formats like MS excel, PDF, CSV, Word,.HTML, XML.



Auto Apply Filters


When we turn on Auto apply filters, paginated report will get update automatically while applying filters to other visual. By default, it will be turned off. 

Finally, I Exported the report in PDF format which looks super neat with clean formatting.


Power BI Table reports Vs Paginated Reports


Paginated reports have ability to print all the data in the table whereas in Power BI reports when we export the multiple page report data into pdf file, the output look like a single page report with a scroll bar which is more like an image or screenshot.
Power BI reports are interactive reports, designed for self-service analytics, while paginated reports prioritize precise formatting and printing for formal reporting needs. The choice between the two depends on the specific requirements of our reporting use case, considering things like interactivity, data exploration, and presentation needs.


When to use paginated reports?


Paginated reports are designed for specific scenarios where precise formatting, printing, and sharing of data in a structured, tabular format are necessary, can be used for large datasets where users can scroll through different pages with ease.

Pros
  • Paginated report ensures pixel perfect consistent formatting for all pages
  • Can handle large datasets
  • Gives professional look
  • Data export capabilities

Cons
  • Less Interactive
  • Report creation depends on specific tool (Report Builder)
  • Not suitable for all types of data
  • Limited interactivity compared to standard Power BI reports.


Conclusion


Paginated reports are valuable when precise formatting, printing, and structured data presentation are required. They are ideal for creating professional, pixel-perfect reports for operational and regulatory reporting scenarios.

Useful Information


Tags Power BI
Useful links https://www.clearpeaks.com/paginated-report-visuals-in-pgwer-bi/
MS Learn Modules https://learn.microsoft.com/en-us/power-bg/visuals/paginated-report-visual
Test Your Knowledge Quiz

Thursday, January 11, 2024

Lesson 43 - Key Influencers in Power BI Desktop

The Key Influencers visual in Power BI uses built-in AI capabilities to identify the factors that have the greatest influence on a selected measure or category. It helps users understand why a metric increases or decreases by highlighting the most significant contributors.

In this blog, we'll learn how to create and use the Key Influencers visual in Power BI.


How to Proceed?


Step 1 
Launch power BI desktop app and open the new report page and import the data required. 


Step 2

In “visualizations” pane click on “Key Influencers” which is highlighted in the given figure. 

Step 3

Drag the required data fields into the Build visual pane. 






Analyze: Metric value we want to analyze - Medal

Explain by: Influencer – Region that influence number of Medals - Region


Expand By: Specifies an additional dimension used to further segment the analysis. It is optional and can be left blank if not required.





Step 4 Features of Key Influencer



There are two tabs in this visual 
  • Key Influencers
  • Top Segments

Key Influencers


Key Influencers shows the top contributors where we can analyze each contributor individually. Here in this visual it shows the analysis like the “medal is more likely gold when the region is USA”. From overall data USA Region is top influencer which has a greater number of data also USA won a most of the gold medals. We have a check box to show values only for influencers in the chart on the Right-side pane.

We have a dropdown in this key Influencer page in which we can choose the metric Value for which we need to analyze the key influencers. Also, we can sort the key influencers either by their Impact or Count which is available in the bottom left of the visual.
Each individual bubble in Key influencer represents the specific factor that influences the metric we are analyzing.

Top Segments





Top Segments tab in Key Influencer Visual analyze the combination which have impact on the analyzed metric. This feature helps in understanding combined effect on the analyzed data.



Here we have 4 segments. By selecting the bubbles display the details of each segment. In segment 1 which is USA have a greater number of medals and from the overall medals they secured a greater number of gold medals.

Step 5

Filters in the chart are like special tools that allow us to focus on specific parts of the data, making it easier to understand. In this visual we Excluded the “No Medal” count.

Step 6

Customizing the appearance of Key Influencers
You can customize the appearance of the visual.  
Gave suitable title for the visual and customize the font size, colour and position of the title.

Key Influencers tab and Top segments can be kept ON/OFF.




If the Counts option is enabled then we can see ring around the influencer bubble which actually represents the percentage of data that an influencer contains.

We can change the bubble colors and their background, secondary element colors etc., 

We can customize the color of the chart which displays on the right side pane of the Key Influencer Visual

Step 7 Save the visual

Finally, your Key Influencers visual is ready. Click Save to save the report.



When to use Key Influencers?


Key Influencer can be used when we need to analyze individual impact of a specific metric. From the analysis we can conclude which factors plays major role in change of metric

Pros
  • We can easily interpret insights from the analysis
  • Even Non-technical users can understand and explore this visual.
  • Quick analysis

Cons
  • Accuracy of data is depending on the quality of data which has high data dependency.
  • Good understanding of data is must for interpreting the results with accuracy

Conclusion

Key Influencers in Power BI are beneficial when we need quick insights into the factors impacting a metric. They are user-friendly .Here in this blog we have analyzed the categorical metric there are also other ways to interpret measures also.


Useful Information


Tags Power BI
Useful links https://databear.com/key-influencers-power-bi-ai-visuals/
MS Learn Modules https://learn.microsoft.com/en-us/power-bi/visuals/power-bi-visualization-influencers?tabs=powerbi-desktopg
Test Your Knowledge Quiz

Wednesday, January 10, 2024

Lesson 42 - Decomposition Tree in Power BI Desktop

The Decomposition Tree visual in Power BI helps users analyze a measure by breaking it down into multiple dimensions and hierarchies. It includes built-in AI capabilities that automatically identify the highest and lowest contributors, making it easier to explore data and discover insights interactively.

In the below blog post will guide through the process of creating Decomposition Tree in Power BI.


How to Proceed?

Step 1 

Launch power BI desktop app and open the new report page and import the data required. 

Step 2 

In “visualizations” pane click on “Decomposition Tree” which is highlighted in the given figure. 
Step 3


Drag the data fields into “Build visual pane“ that we want to and analyze.
Analyze: The measure or KPI to analyze (Count of Medal).

Explain by: One or more dimensions used to break down the measure (Region, Gender).

Tooltips: Add additional fields to display more information when hovering over the visual.


Step 4 Features of Decomposition Tree


Each time you expand a node, Power BI allows you to choose one of the following:

High value – Displays the category with the highest contribution.
Low value – Displays the category with the lowest contribution.
AI split – Automatically selects the next best category based on AI analysis.
Any field added under Explain by.


AI Splits is the feature of decomposition Tree which has the ability to find out the highest and lowest value of our data.
When we hover on the bulb icon it also displays an explanation as a tooltip.

To make use of this AI features we should Enable AI splits on under Format visual pane.
The selected branch expands to display the chosen category, while AI splits automatically identify the most significant contributors based on the data.

Step 5

Filters in the chart are like special tools that allow us to focus on specific parts of the data, making it easier to understand. In this visual we Excluded the “No Medal” count.

Step 6

Customizing the appearance of Decomposition Tree
You can customize the appearance of the visual.  
Gave suitable title for the visual and customize the font size, colour and position of the title.

We can customize the space related settings for the tree nodes under Tree settings.
 

Here in the Tree, the bars representing the categorical data. We can adjust the nodes bar by using this bar settings
Likewise, we can customize the colors of the bar represented in the tree, their background etc.


We have an option “Conditional Formatting” where can customize the data bar color


Click on the More options (...) on the header icon of the visual to export the data or to sort the data based on the requirements


Report creator can lock the particular levels where it can’t be removed or changed. Hence users can explore different level of hierarchies but they can’t change or move the levels
Step 7 Save the visual


Finally, your Decomposition Tree visual is ready. Click Save to save the report.







When to use Decomposition Tree?


Decomposition tree can be used when we need to analyze the metrics which can be broken down into multiple categories also, we can use this when we need to understand the KPI’s.

Pros
  • Interactive and easy to explore.
  • AI-assisted analysis helps identify key contributors.
  • Supports hierarchical drill-down.
  • Useful for root cause analysis.
  • Makes complex data easier to understand.
Cons
  • Best suited for hierarchical analysis.
  • Large numbers of levels can make the visual difficult to read.
  • AI insights depend on the quality of the underlying data.

Conclusion


The Decomposition Tree visual is a powerful analytical tool for exploring hierarchical data and identifying the factors that contribute to a measure. Its built-in AI capabilities make it easier to perform root cause analysis and uncover insights with minimal effort.


Useful Information


Tags Power BI
Useful links
MS Learn Modules
Test Your Knowledge Quiz