Saturday, January 13, 2024

Lesson 44 - Python Visual in Power BI Desktop

Power BI is a great visualization tool in which now python is also integrated and now we can extend power BI’s capabilities by using data science and Machine learning libraries in Power BI.

In this blog we going to see how to run basic python scripts directly for importing datasets and to use python visual in power BI for visualizations. 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 script runs more than 30mins will get timed 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.
Refer Lesson 2 – Introduction to Power BI Desktop 


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 integrate python with Power BI you need to install packages “matplotlib” and “pandas”

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 Values section to analyze.  

Based on the fields selected for analyze python editor by default create a data frame named dataset.
It will remove duplicates. By default, aggregation is don’t summarise.


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.


We cannot format the created Python visual in Power BI. Standard formatting can only be done.


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.
  • Advance analytics capability
  • 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 to work on python visual.
  • Low 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.


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

Friday, January 12, 2024

Lesson 43 - Paginated Reports in Power BI Desktop

Paginated reports are ideal for scenarios where we need to print or share reports in a format that resembles traditional paper-based reports. In this we have more control for printed reports, it can fit well on a page. These reports contain tables, matrices, charts, and other elements that are formatted to fit on a page. This paginated report visual integrated with Power BI to bring added feature to the reports.

To create a Paginated report visual, you must be signed into the Power BI service. We can create paginated report in Power BI service but u can’t format anything in Power BI service. We can edit the paginated report created in Power BI service with Power BI report Builder

You can download via Microsoft download Centre (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 u 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. Choose connect to report to access the created paginated report from the power BI service

Step 3

I have already uploaded “Olympic Events” Data into OneLake data hub. Choose the data and create a paginated report


Step 4

In the Power BI service Click on the Create button and start creating Paginated report.


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

We can further edit this paginated report in Report builder too.


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


Turn On the Toolbar Setting in Formatting section 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.
We can use the arrow button to go through next pages of report. we can export up to 1,000,000 rows to excel


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
  • We cannot drill through the reports


Conclusion

Paginated reports are valuable for use cases where precise formatting, printing, and structured data presentation are important. They are suitable handle scenarios where we require professional-looking documents with consistent layouts. However, the choice to use paginated reports depends on specific reporting needs, user preferences etc.

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

Thursday, January 11, 2024

Lesson 42 - Key Influencers in Power BI Desktop

Power BI has many features or visuals in analyzing the data, Here the Key Influencer visuals is known for its powerful way to analyze and identify the factors that influencing specific metric or any measure in our data.

In the below blog post will guide through the process of creating Key Influencers 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 data fields into “Field Section “that we want to and analyze. 






Analyze: Metric value we want to analyze - Medal

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


Expand By: To analyze Measure value as a metric- Currently we left as it is since we
analyzing categorical value as a metric





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, Key Influencer is ready. Click save button to save the visual.


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.




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

Wednesday, January 10, 2024

Lesson 41 - Decomposition Tree in Power BI Desktop

Power BI has many features or visuals in analyzing the data, Here the decomposition tree which allows us to breakdown into hierarchies and analyze the data in an interactive way. Decomposition tree also known for Artificial Intelligence Visualization.

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 “Field Section “that we want to and analyze.
Analyze: Metric value we want to analyze – Count of Medal

Explain by: One or more Dimension need to be drill down – Region, Gender
We can show further information about data using Tooltip option

Step 4 Features of Decomposition Tree


In this visual we have chosen “Count of Medal” as the metric and further drilling down by Region and Gender dimensions. Every time when we add a dimension to the metric it asks for a “High value”, “Low Value” and the respective field name. Here I choosed the High Value.

Highest value will be represented as a dotted line. Also u can see the Bulb Icon above which is the feature called “AI Splits”
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 section

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 3 dotted line 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, Decomposition Tree is ready. Click save button to save the visual.







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
  • Easy to understand
  • Interactive visual
  • Effective communication of complex data into meaningful insights
  • AI features
Cons
  • It is not suitable for all types of visualizations 
  • Become clumsy if add multiple nodes.
Conclusion

The Decomposition Tree in Power BI is a valuable tool for exploring and analyzing complex hierarchical data. It is particularly effective for gaining insights about metrics and its categories. Having AI features is the added advantage to this visual in Power BI.




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