Create a sample visual in power BI using Python script

0 votes
Create a sample visual in power BI using Python script. Basic steps to run a Python script.
Jun 20 in Power BI by Rahul
44 views

1 answer to this question.

0 votes

Follow the below steps:

1. Run Power BI and load the data source.

2. If Python Script does not exist, then to setup python script in Power BI visit below link,

https://www.edureka.co/community/49714/setup-python-with-power-bi

3. Once Python is setup. Click on Python Script on the desktop window.

4. Python script visual is seen on the screen.

5. Go to Python script and select the fields that you want to use in visual.

6. Now install matplotlib in python using pip.

7. Then write code as below - to create a bar chart.

import matplotlib.pyplot as plt

plt.bar(dataset.Market,dataset.Sales)

plt.xlabel("Sales")

plt.ylabel("Profit")

plt.show()

To create a Scatter chart using Python - use below code with different fields as required.

import matplotlib.pyplot as plt

plt.plot(dataset.Sales,dataset.Profit,'go')

plt.xlabel("Sales")

plt.ylabel("Profit")

plt.show()

Another example of pair plot that is present on the top right side of the screen with multiple graphs is used to show the correlation of different fields.

import matplotlib.pyplot as plt

import seaborn as ssn

ssn.pairplot(dataset)

plt.show()

In the above 2 Python scripts, within ' '  indicates the type of plot and color such as g,r indicates green and red color for the graph and o,- indicates scatter plot or dashed line chart and combining both you would get a dual axis chart.

So you can play around with plot function and different plots available using format. 

Different plot libraries are available in python to use other than mathplotlib. One such package is seaborn

I have created few charts in Power BI using Python, You can check out them below - 

answered Jun 20 by Cherukuri
• 17,870 points

Related Questions In Power BI

0 votes
0 answers

Create a sample report in power BI using R script

how to create a sample chart using ...READ MORE

Jun 20 in Power BI by Anitha
16 views
0 votes
1 answer

How do you create a link visual in Power BI?

You can easily create a link between ...READ MORE

answered Mar 8 in Power BI by Avantika
• 1,500 points

edited Mar 9 by Avantika 52 views
0 votes
1 answer

Can I create a Power BI report in Office 365 without my locally installed Office Excel?

Yess!! You can achieve this by using ...READ MORE

answered Sep 26, 2018 in Power BI by Kalgi
• 37,320 points
47 views
0 votes
1 answer

To create link visual in Power BI

You can disable sandboxing by adding this ...READ MORE

answered Nov 21, 2018 in Power BI by Upasana
• 8,430 points
33 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 133 views
0 votes
1 answer

How to create final table based on Joins of two tables in power BI?

Hi Nithin, It is easy and simple. 1. Go ...READ MORE

answered Mar 1 in Power BI by Cherukuri
• 17,870 points
76 views
0 votes
1 answer

Chart with only some values in field in a graph in power BI?

Hi Banu, While creating a chart, put the ...READ MORE

answered Apr 10 in Power BI by Cherukuri
• 17,870 points
16 views