<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using Python to Connect to Power BI data model in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4014233#M53765</link>
    <description>&lt;P&gt;Hello. I have what seems like should be an easy solution. We have some reports that are already created and published that we want to use Python to create control charts with. Everything I can find on the web - so far - references connections to outside sources. How do I get Python to read the existing data model in Power BI?&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2024 22:11:08 GMT</pubDate>
    <dc:creator>boyddt_mn</dc:creator>
    <dc:date>2024-06-27T22:11:08Z</dc:date>
    <item>
      <title>Using Python to Connect to Power BI data model</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4014233#M53765</link>
      <description>&lt;P&gt;Hello. I have what seems like should be an easy solution. We have some reports that are already created and published that we want to use Python to create control charts with. Everything I can find on the web - so far - references connections to outside sources. How do I get Python to read the existing data model in Power BI?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 22:11:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4014233#M53765</guid>
      <dc:creator>boyddt_mn</dc:creator>
      <dc:date>2024-06-27T22:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Connect to Power BI data model</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4014423#M53768</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/170586"&gt;@boyddt_mn&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following link shares about using Python scripts to import a data source, clean the data, analyze the data and create visualizations with it:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/PYTHON-INTEGRATION-WITH-POWER-BI-IMPORTING-EXCEL-TO-POWER-BI/m-p/948952" target="_blank"&gt;Solved: PYTHON INTEGRATION WITH POWER BI - IMPORTING EXCEL... - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use Python scripts to manipulate existing data. This can be done in the "Transform" tab under the Edit queries section. There is an option to select "Run Python Script". Once you select this option a dialog box will open and you can write the Python script you want.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-in-query-editor" target="_blank"&gt;Use Python in Power BI Power Query Editor - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the related document, you can view this content:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/73121330/how-to-read-data-from-power-bi-dataset-to-python" target="_blank"&gt;pandas - How to read Data From Power BI Dataset to Python - Stack Overflow&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-read-Data-From-Power-BI-Dataset-to-Python/td-p/2661628" target="_blank"&gt;Solved: How to read Data From Power BI Dataset to Python - Microsoft Fabric Community&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts" target="_blank"&gt;Run Python scripts in Power BI Desktop - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 01:40:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4014423#M53768</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-28T01:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using Python to Connect to Power BI data model</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4015790#M53781</link>
      <description>&lt;P&gt;Thank you for your response but these don't three of the five links don't reference connecting to a local data model. The second and third links suggest using dataset to connect to the local model but Power BI returns "NameError: name 'dataset' is not defined". I've tried a couple if iterations but haven't had much luck. Here is my code:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;import pandas as pd&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import seaborn as sb&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;import matplotlib.pyplot as plt&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;CAPA_Main = dataset[dataset["CAPA_Main"]]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;plt.bar(CAPA_Main.capa_main.created_date, CAPA_Main.capa_main.cap_number)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;plt.xlabel("Date")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;plt.ylabel("NR Count")&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;plt.show&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;and here is a screenshot of my data model&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="boyddt_mn_0-1719583648532.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1123975i615789764E3B12FF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="boyddt_mn_0-1719583648532.png" alt="boyddt_mn_0-1719583648532.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 14:07:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Using-Python-to-Connect-to-Power-BI-data-model/m-p/4015790#M53781</guid>
      <dc:creator>boyddt_mn</dc:creator>
      <dc:date>2024-06-28T14:07:56Z</dc:date>
    </item>
  </channel>
</rss>

