<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.0.0">Jekyll</generator><link href="https://pawarbi.github.io/blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://pawarbi.github.io/blog/" rel="alternate" type="text/html" /><updated>2023-05-11T13:23:12-05:00</updated><id>https://pawarbi.github.io/blog/feed.xml</id><title type="html">Sandeep Pawar</title><subtitle>Data Analytics, Data Science Professional with expertise in Microsoft Data stack (Power BI, Azure)</subtitle><entry><title type="html"></title><link href="https://pawarbi.github.io/blog/2023/05/11/2021-01-20-timeseries-forecasting-in-powerbi.html" rel="alternate" type="text/html" title="" /><published>2023-05-11T13:23:12-05:00</published><updated>2023-05-11T13:23:12-05:00</updated><id>https://pawarbi.github.io/blog/2023/05/11/2021-01-20-timeseries-forecasting-in-powerbi</id><content type="html" xml:base="https://pawarbi.github.io/blog/2023/05/11/2021-01-20-timeseries-forecasting-in-powerbi.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2021-01-20-timeseries-forecasting-in-powerbi.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Forecasting-in-Power-BI&quot;&gt;Forecasting in Power BI&lt;a class=&quot;anchor-link&quot; href=&quot;#Forecasting-in-Power-BI&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;I have written and talked about Time Series Forecasting previously, especially on how to create forecasts in Power BI. You can refer to my previous blog posts below:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Time series Forecasting in Python &amp;amp; R, Part 1 (EDA)&lt;/strong&gt;: &lt;a href=&quot;https://pawarbi.github.io/blog/forecasting/r/python/rpy2/altair/2020/04/21/timeseries-part1.html&quot;&gt;Link&lt;/a&gt; This blog covers exploratory data analysis techniques for time series data before creating the forecast.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Time series Forecasting in Python &amp;amp; R, Part 2 (Forecasting)&lt;/strong&gt;: &lt;a href=&quot;https://pawarbi.github.io/blog/forecasting/r/python/rpy2/altair/fbprophet/ensemble_forecast/uncertainty/simulation/2020/04/21/timeseries-part2.html&quot;&gt;Link&lt;/a&gt; Here I go into theoretical and practical aspects of creatings forecasts using many different classical forecasting methods&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Time series Forecasting in Power BI&lt;/strong&gt;: &lt;a href=&quot;https://pawarbi.github.io/blog/forecasting/python/powerbi/forecasting_in_powerbi/2020/04/24/timeseries-powerbi.html&quot;&gt;Link&lt;/a&gt; This blog shows how to create forecasts in Power BI, its strengths, limitations, and my recommendations.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;I recently presented on this topic at &lt;a href=&quot;http://www.aibootcampsg.com/&quot;&gt;Global AI Bootcamp, Singapore&lt;/a&gt;. Here is the recording of that presentation. It summarizes my findings from the blog above.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;
&lt;center&gt;
    &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/TgzJsMUncd?amp=1&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author></entry><entry><title type="html"></title><link href="https://pawarbi.github.io/blog/2023/05/11/2021-04-05-operationalizing-ml-models-powerbi-azureml-mlops.html" rel="alternate" type="text/html" title="" /><published>2023-05-11T13:23:12-05:00</published><updated>2023-05-11T13:23:12-05:00</updated><id>https://pawarbi.github.io/blog/2023/05/11/2021-04-05-operationalizing-ml-models-powerbi-azureml-mlops</id><content type="html" xml:base="https://pawarbi.github.io/blog/2023/05/11/2021-04-05-operationalizing-ml-models-powerbi-azureml-mlops.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2021-04-05-operationalizing-ml-models-powerbi-azureml-mlops.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Machine-Learning-in-Power-BI&quot;&gt;Machine Learning in Power BI&lt;a class=&quot;anchor-link&quot; href=&quot;#Machine-Learning-in-Power-BI&quot;&gt; &lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;Power BI and Azure ML have native integration with each other, which means not only you can consume the model deploy in Power BI but also use the resources/tools in Azure ML to manage the MLOps process. There is a misconception that you need Power BI Premium to use Azure ML. In this session I show that's not the case. Below are the topics covered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Limitation of using Python or R in Power BI&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Formula firewall&lt;/li&gt;
&lt;li&gt;Privacy setting of the datasource must be Public&lt;/li&gt;
&lt;li&gt;30 min query timeout&lt;/li&gt;
&lt;li&gt;Have to use personal gateway&lt;/li&gt;
&lt;li&gt;Cannot use enhanced metadata&lt;/li&gt;
&lt;li&gt;Dependency management&lt;/li&gt;
&lt;li&gt;Not scaleable&lt;/li&gt;
&lt;li&gt;No MLOps&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Steps to access Azure ML models in Power BI&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Give Azure ML access to Power BI tenant in IAM&lt;/li&gt;
&lt;li&gt;Use scoring script with input/output schema&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;&lt;img src=&quot;https://docs.microsoft.com/en-us/azure/machine-learning/media/concept-azure-machine-learning-architecture/architecture.svg&quot; alt=&quot;aml&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h4 id=&quot;Topics-Covered:&quot;&gt;Topics Covered:&lt;a class=&quot;anchor-link&quot; href=&quot;#Topics-Covered:&quot;&gt; &lt;/a&gt;&lt;/h4&gt;&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Invoking Azure ML models in Power Query in Desktop and using dataflow in service&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Thoughts on batch-scoring&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Other considerations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Azure ML models can only be called for real-time inference.&lt;/li&gt;
&lt;li&gt;Use ACI for small models and AKS for large models that requore GPU, scaleable compute, low latency, high availability&lt;/li&gt;
&lt;li&gt;Real-time inferencing is expensive! Use batch scoring if real-time is not needed&lt;/li&gt;
&lt;li&gt;Incremental refreshes in Power BI will work with models invoked from Azure ML but watch out for (query) performance&lt;/li&gt;
&lt;li&gt;With Azure Arc, you can use your own Kubernets service! Deploy the model in Azure ML but use your own K8 (AWS, GCP etc.)&lt;/li&gt;
&lt;li&gt;Premium Per User gives you access to Auto ML. If you have access to PPU, it may be worth first experimenting with AutoML before using Azure ML model to save cost. PPU Automl doesn't offer the same level of MLOps capabilities though. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;
&lt;center&gt;
    &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/oLdMFJIxWDo&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;References:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/power-bi/connect-data/service-aml-integrate&quot;&gt;https://docs.microsoft.com/en-us/power-bi/connect-data/service-aml-integrate&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://pawarbi.github.io/blog/powerbi/r/python/2020/05/15/powerbi-python-r-tips.html&quot;&gt;https://pawarbi.github.io/blog/powerbi/r/python/2020/05/15/powerbi-python-r-tips.html&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://azure.microsoft.com/en-us/blog/innovate-across-hybrid-and-multicloud-with-new-azure-arc-capabilities/&quot;&gt;https://azure.microsoft.com/en-us/blog/innovate-across-hybrid-and-multicloud-with-new-azure-arc-capabilities/&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts&quot;&gt;https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-power-bi-custom-model&quot;&gt;https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-power-bi-custom-model&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author></entry><entry><title type="html"></title><link href="https://pawarbi.github.io/blog/2023/05/11/2021-08-25-powerbi-automl-deepdive.html" rel="alternate" type="text/html" title="" /><published>2023-05-11T13:23:12-05:00</published><updated>2023-05-11T13:23:12-05:00</updated><id>https://pawarbi.github.io/blog/2023/05/11/2021-08-25-powerbi-automl-deepdive</id><content type="html" xml:base="https://pawarbi.github.io/blog/2023/05/11/2021-08-25-powerbi-automl-deepdive.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2021-08-25-powerbi-automl-deepdive.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Power-BI-AutoML-Deep-Dive&quot;&gt;Power BI AutoML Deep Dive&lt;a class=&quot;anchor-link&quot; href=&quot;#Power-BI-AutoML-Deep-Dive&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In this session I wanted to show, not only how to create the machine learning models, but more importantly how to create models that answer business questions and are explainable and robust. Please watch and let me know your thoughts. Topic covered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Machine Learning Basics&lt;/li&gt;
&lt;li&gt;License Requirements&lt;/li&gt;
&lt;li&gt;How to create models that are:&lt;ul&gt;
&lt;li&gt;Business focused (cost/loss functions/profit curves)&lt;/li&gt;
&lt;li&gt;Generalizable (underfitting/overfitting/error terrain analysis)&lt;/li&gt;
&lt;li&gt;Interpretable (SHAP, feature importance)&lt;/li&gt;
&lt;li&gt;Manageable (MLOps process and workflow)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Recommendations, Limitations&lt;/li&gt;
&lt;/ul&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;blockquote&gt;&lt;p&gt;youtube &lt;a href=&quot;https://youtu.be/_CaFacQiW_E&quot;&gt;https://youtu.be/_CaFacQiW_E&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author></entry><entry><title type="html">Controlling Marker Size Sensitivity in Scatter Plot in Power BI</title><link href="https://pawarbi.github.io/blog/powerbi/scatterplot/dataviz/2023/04/24/powerbi-scatterplot-markersize.html" rel="alternate" type="text/html" title="Controlling Marker Size Sensitivity in Scatter Plot in Power BI" /><published>2023-04-24T00:00:00-05:00</published><updated>2023-04-24T00:00:00-05:00</updated><id>https://pawarbi.github.io/blog/powerbi/scatterplot/dataviz/2023/04/24/powerbi-scatterplot-markersize</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/scatterplot/dataviz/2023/04/24/powerbi-scatterplot-markersize.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2023-04-24-powerbi-scatterplot-markersize.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Video:&quot;&gt;Video:&lt;a class=&quot;anchor-link&quot; href=&quot;#Video:&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;
&lt;center&gt;
    &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/OctAWvw_hdw&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Controlling Marker Size Sensitivity in Power BI Scatter Plot</title><link href="https://pawarbi.github.io/blog/powerbi/dataviz/scatterplot/2023/04/05/powerbi-interview-preparation-using-bing-chatgpt-copy.html" rel="alternate" type="text/html" title="Controlling Marker Size Sensitivity in Power BI Scatter Plot" /><published>2023-04-05T00:00:00-05:00</published><updated>2023-04-05T00:00:00-05:00</updated><id>https://pawarbi.github.io/blog/powerbi/dataviz/scatterplot/2023/04/05/powerbi-interview-preparation-using-bing-chatgpt-copy</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/dataviz/scatterplot/2023/04/05/powerbi-interview-preparation-using-bing-chatgpt-copy.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2023-04-05-powerbi-interview-preparation-using-bing-chatgpt copy.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;The-Problem:&quot;&gt;The Problem:&lt;a class=&quot;anchor-link&quot; href=&quot;#The-Problem:&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In Power BI, when you create a scatter plot, you have an option to change the size of the marker based on a column or a measure. This helps the user to do multivariate analysis by encoding the marker size. Although you can change the size of the marker, only the developer can set it and a big limitation is that the size scales uniformly. See below for example. The left scatter plot is the default and the one on the right is after controlling the sensitivity.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/marker%20sensitivity.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;The-Solution&quot;&gt;The Solution&lt;a class=&quot;anchor-link&quot; href=&quot;#The-Solution&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Solution is rather simple. We just create another measure and exponentiate it to lengthen the scale. For example, if you have a measure &lt;code&gt;[Sales]&lt;/code&gt; used to denote marker size, you use &lt;code&gt;[Sales]^100&lt;/code&gt;. To give the developer and user better control, we can create parameter to adjust the value. Watch the video on how to do this :

&lt;center&gt;
    &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/OctAWvw_hdw&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">DAX Measure to Dynamically Offset Datetime Based on Daylight Savings Time</title><link href="https://pawarbi.github.io/blog/powerbi/dax/daylightsavings/2023/03/29/powerbi-dax-adjust-daylight-savings.html" rel="alternate" type="text/html" title="DAX Measure to Dynamically Offset Datetime Based on Daylight Savings Time" /><published>2023-03-29T00:00:00-05:00</published><updated>2023-03-29T00:00:00-05:00</updated><id>https://pawarbi.github.io/blog/powerbi/dax/daylightsavings/2023/03/29/powerbi-dax-adjust-daylight-savings</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/dax/daylightsavings/2023/03/29/powerbi-dax-adjust-daylight-savings.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2023-03-29-powerbi-dax-adjust-daylight-savings.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Adjusting-Time-Based-on-DST&quot;&gt;Adjusting Time Based on DST&lt;a class=&quot;anchor-link&quot; href=&quot;#Adjusting-Time-Based-on-DST&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;It's often a requirement in Power BI reports to use dates or display refresh times. The best practice is to calculate the refresh time &lt;a href=&quot;https://www.fourmoo.com/2017/10/10/using-power-bi-to-ensure-daylight-savings-dates-and-times-change-dynamically/&quot;&gt;using M&lt;/a&gt; but if you are using Direct Query or streaming dataset, it's not an option. You have to create a DAX measure. I recently had such requirement to show refresh time based on Pacific Time zone. Below measure calculates the current time in UTC timezone and returns time in Pacific time zone adjusted for daylight savings time. I used official rules from &lt;a href=&quot;https://www.nist.gov/pml/time-and-frequency-division/popular-links/daylight-saving-time-dst&quot;&gt;here&lt;/a&gt;, which state:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;DST begins on the second Sunday of March&lt;/li&gt;
&lt;li&gt;DST ends on the first Sunday of November&lt;/li&gt;
&lt;/ul&gt;

&lt;pre&gt;&lt;code&gt;Page Refreshed Datetime =
// https://www.nist.gov/pml/time-and-frequency-division/popular-links/daylight-saving-time-dst
// Calculates time in Pacific timezone

VAR _utcnow =
    UTCNOW ()
VAR _year =
    YEAR ( _utcnow )
VAR _utcdate =
    DATE ( YEAR ( _utcnow ), MONTH ( _utcnow ), DAY ( _utcnow ) ) // DST begins on the second Sunday of March    
VAR _dstbegins =
    DATE ( _year, 3, 1 )
        + MOD ( 8 - WEEKDAY ( DATE ( _year, 3, 1 ) ), 7 ) + 7 // DST ends on the first Sunday of November            
VAR _dstends =
    DATE ( _year, 11, 1 )
        + MOD ( 8 - WEEKDAY ( DATE ( _year, 11, 1 ) ), 7 )
VAR _IsDST = _utcdate &amp;gt;= _dstbegins
    &amp;amp;&amp;amp; _utcdate &amp;lt; _dstends
RETURN
    SWITCH (
        TRUE,
        _IsDST, _utcnow - TIME ( 7, 00, 00 ), //For Pacific Timezone
        _utcnow - TIME ( 8, 00, 00 )
    )&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Stripping Off Analysis Services Connection From Multiple Power BI Files</title><link href="https://pawarbi.github.io/blog/powerbi/analysisservices/as/powershell/2023/03/01/powerbi-analysisservices-stripping-connection.html" rel="alternate" type="text/html" title="Stripping Off Analysis Services Connection From Multiple Power BI Files" /><published>2023-03-01T00:00:00-06:00</published><updated>2023-03-01T00:00:00-06:00</updated><id>https://pawarbi.github.io/blog/powerbi/analysisservices/as/powershell/2023/03/01/powerbi-analysisservices-stripping-connection</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/analysisservices/as/powershell/2023/03/01/powerbi-analysisservices-stripping-connection.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2023-03-01-powerbi-analysisservices-stripping-connection.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Stripping-Off-AS-Connection&quot;&gt;Stripping Off AS Connection&lt;a class=&quot;anchor-link&quot; href=&quot;#Stripping-Off-AS-Connection&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;I recently completed a project to migrate 45 Power BI reports from analysis services to Power BI Premium datasets. If you have a Power BI file (*.pbix) that's connected to AS instance, and if you don't have access to AS, opening the Power BI file give you an error message below.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/ASPBI1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;p&gt;The solution to this is to use a &lt;a href=&quot;https://powerbi.tips/2020/05/hot-swap-power-bi-report-connections/&quot;&gt;PowerShell script&lt;/a&gt; developed and shared by &lt;a href=&quot;https://powerbi.tips/author/steve-campbell/&quot;&gt;Steve Campbell&lt;/a&gt;. This script works perfectly. But in my case, I had 45 reports so instead of manually applying the script to 45 reports, I just modified it a bit to strip off the connection, save the pbix and also copy the original pbix files to another folder for backup. &lt;strong&gt;Please note that Steve gets 100% credit for this script&lt;/strong&gt;, I merely modified it to suit my purposes. Please &lt;a href=&quot;https://powerbi.tips/2020/05/hot-swap-power-bi-report-connections/&quot;&gt;refer to blog&lt;/a&gt; for his instructions to use the original script.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Steps&quot;&gt;Steps&lt;a class=&quot;anchor-link&quot; href=&quot;#Steps&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;ol&gt;
&lt;li&gt;Save all the pbix files to a folder. Copy the folder path.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/ASPBI2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Replace the folder path for &lt;code&gt;$dir&lt;/code&gt; variable as shown below. Note that the folder path must end with \&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/ASPBI3.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Run the PowerShell&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;That's it. If you now go back to the above folder, you will see another folder created called &lt;code&gt;original_pbix&lt;/code&gt;. This folder has the original pbix files with AS connections. Files in the base folder should now be devoid of AS connection.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/ASPBI4.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open the pbix and point to the Power BI dataset. As long as all the column, table, measure names etc are the same as the AS, you should be able to successfully map the report to the Power BI dataset. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/ASPBI5.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h3 id=&quot;Script&quot;&gt;Script&lt;a class=&quot;anchor-link&quot; href=&quot;#Script&quot;&gt; &lt;/a&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;
##### Script to strip-off AS Connection and save the PBIX files 
##### Original script: https://powerbi.tips/2020/05/hot-swap-power-bi-report-connections/
##### Input from Bryan Campbell, Hitachi Solutions America
##### Modified the original by Sandeep Pawar to apply en-masse to many files
##### Ver 1.0 | Last Update: 10/26/2022

&amp;lt;#
Instructions: 

1. Save the PBIX with Analysis Services connections to a folder
2. Change the $dir variable below to above folder path

#&amp;gt; 


$dir = &quot;C:\Users\&amp;lt;path&amp;gt;\AS PBI Files\&quot; #Be sure to have a \ at the end

&quot;Checking if $dir  exists&quot;
if (Test-Path -Path $dir) {

    #Copy files to a new folder for backup
    New-Item -Path $dir'original_pbix' -ItemType Directory
    Copy-Item -Path $dir'*.pbix' -Destination $dir'original_pbix'


    $pbi_files = Get-ChildItem -Path $dir -Filter *.pbix


    # Loop over each file, strip off and save the file as a zip file

    foreach ($file in $pbi_files) {

    $pathn =  $dir+$file.Name 

        Write-Output &quot;Extracting &quot; $file
        #Error check function
        function IsFileLocked([string]$filePath){
            Rename-Item $filePath $filePath -ErrorVariable errs -ErrorAction SilentlyContinue
            return ($errs.Count -ne 0)
        }


        #Choose file
        try {$pathn}
        catch { &quot;Incompatible File&quot; }


        #Check for errors
        If([string]::IsNullOrEmpty($pathn )){            
            exit } 

        elseif ( IsFileLocked($pathn) ){
            exit } 

        #Run Script
        else{    

            #Unzip pbix
            [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression')
            $zipfile = $pathn.Substring(0,$pathn.Length-4) + &quot;zip&quot;
            Rename-Item -Path $pathn -NewName  $zipfile

            #Delete files
            $files   = 'Connections', 'SecurityBindings'
            $stream = New-Object IO.FileStream($zipfile, [IO.FileMode]::Open)
            $mode   = [IO.Compression.ZipArchiveMode]::Update
            $zip    = New-Object IO.Compression.ZipArchive($stream, $mode)
            ($zip.Entries | ? { $files -contains $_.Name }) | % { $_.Delete() }

            #Close zip
            $zip.Dispose()
            $stream.Close()
            $stream.Dispose()


        }

    }


    # Change the *.zip to *.pbix

    $stripped_models = Get-ChildItem -Path $dir -Filter *.zip
    $stripped_models | Rename-Item -newname { $_.name -replace '.zip','.pbix' }




    } 
else {
    &quot;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ERROR Path:  $dir doesn't exist   &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&quot;
}&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;Thanks to my colleague Bryan Campbell for his help.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Streaming Data From A File To Power BI Streaming Dataset Using Python</title><link href="https://pawarbi.github.io/blog/powerbi/pandas/python/api/streaming/dataset/2023/01/13/streaming-dataset-powerbi-pandas-python.html" rel="alternate" type="text/html" title="Streaming Data From A File To Power BI Streaming Dataset Using Python" /><published>2023-01-13T00:00:00-06:00</published><updated>2023-01-13T00:00:00-06:00</updated><id>https://pawarbi.github.io/blog/powerbi/pandas/python/api/streaming/dataset/2023/01/13/streaming-dataset-powerbi-pandas-python</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/pandas/python/api/streaming/dataset/2023/01/13/streaming-dataset-powerbi-pandas-python.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2023-01-13-streaming-dataset-powerbi-pandas-python.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Streaming-Dataset&quot;&gt;Streaming Dataset&lt;a class=&quot;anchor-link&quot; href=&quot;#Streaming-Dataset&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;It's easy to create a streaming dataset in Power BI for real-time applications. You do not need a premium capacity. To keep the blog short, I am going to assume you already know what is a streaming dataset and how it differs from import/DQ. If you are not familiar, &lt;a href=&quot;https://learn.microsoft.com/en-us/power-bi/connect-data/service-real-time-streaming&quot;&gt;this documentation&lt;/a&gt; will help.&lt;/p&gt;
&lt;p&gt;Imagine you are creating a POC and would like to develop the real-time dashboard, report or just want to show to your stakeholders what the solution would loook like, you will need data to stream to Power BI service. You can create Azure Event Hub, Streaming Analytics. But in this blog, I will show you how you can stream data from an existing file. I will also include a link below in the resources for a few sample datasets you can use depending on the use case.&lt;/p&gt;
&lt;p&gt;You will need a Python IDE with pandas installed.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/msedge_umtOfdekx5.gif&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h5 id=&quot;Create-A-Streaming-dataset&quot;&gt;Create A Streaming dataset&lt;a class=&quot;anchor-link&quot; href=&quot;#Create-A-Streaming-dataset&quot;&gt; &lt;/a&gt;&lt;/h5&gt;&lt;p&gt;First create a streaming dataset in Power BI service using the API method.
&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/KP9NMM8b4g.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;I will be using &lt;a href=&quot;https://github.com/reisanar/datasets/blob/master/eBayAuctions.csv&quot;&gt;this dataset&lt;/a&gt; for my example. Note the columns and column types from your data and create the dataset in Power BI service accordingly. 
&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/msedge_dyzzbjo5kF.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;Note the API endpoint:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/msedge_imlnDaqdcW.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;That's it. We are now ready to stream the data to Power BI service.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Python-Script&quot;&gt;Python Script&lt;a class=&quot;anchor-link&quot; href=&quot;#Python-Script&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;I will import the data using pandas.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;requests&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;datetime&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;dataclasses&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;dataclass&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;np&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;typing&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;List&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Dict&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;time&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pandas&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pd&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;nd&quot;&gt;@dataclass&lt;/span&gt;


&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;StreamToPowerBI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    
    &lt;span class=&quot;sd&quot;&gt;&amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;    Class to stream data to Power BI Streaming dataset&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    --------------------------------------------------&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    Example:&lt;/span&gt;

&lt;span class=&quot;sd&quot;&gt;     - endpoint :  API ednpoint, e.g. &amp;quot;https://api.powerbi.com/beta/&amp;lt;ws_id&amp;gt;/datasets/&amp;lt;dataset_id&amp;gt;/rows?key=&amp;lt;___key___&amp;gt;&amp;quot;&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;     - data     :  Data in dictionary e.g. {&amp;quot;id&amp;quot;:1, &amp;quot;Value&amp;quot;:2.33, &amp;quot;Color&amp;quot;:&amp;quot;Red&amp;quot;} &lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;                   Number of columns, column names and column type must match with Power BI.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;     - delay    :  Delay in seconds in sending the data to Power BI. e.g. if delay is 3, data will be sent every 3 seconds.&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;                   default value is 2 seconds. To overwrite, use the wait() method&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;                   &lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;                   &lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;     example:      To stream data to the specified endpoint with 5 s delay&lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;                   StreamToPowerBI(endpoint,data).wait(5).post_data()              &lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt; &lt;/span&gt;
&lt;span class=&quot;sd&quot;&gt;    &amp;quot;&amp;quot;&amp;quot;&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Dict&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;delay&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;   
        
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;sd&quot;&gt;&amp;#39;&amp;#39;&amp;#39; Delay in seconds to stream the data &amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;c1&quot;&gt;# default value is 2 seconds&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;other&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; 
        &lt;span class=&quot;n&quot;&gt;sleep&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;other&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;    
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;
    
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;post_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;sd&quot;&gt;&amp;#39;&amp;#39;&amp;#39; Use post method send the data to Power BI&amp;#39;&amp;#39;&amp;#39;&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;isinstance&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;  &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;
            &lt;span class=&quot;n&quot;&gt;payload&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

            &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;requests&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;json&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;payload&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;status_code&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;==&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;200&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
                &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Failed ! Check endpoint, data&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Data passed is not a dictionary. It should be in the format &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{}&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;
    
    
    
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h4 id=&quot;Data&quot;&gt;Data&lt;a class=&quot;anchor-link&quot; href=&quot;#Data&quot;&gt; &lt;/a&gt;&lt;/h4&gt;&lt;p&gt;Import the data using pandas or any other library (spark, polars etc.). Be sure to make the numeric columns type &lt;code&gt;float&lt;/code&gt; otherwise json serialization will fail. I am also removing null values.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pd&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_csv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;https://raw.githubusercontent.com/reisanar/datasets/master/eBayAuctions.csv&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                  &lt;span class=&quot;n&quot;&gt;index_col&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;None&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
                  &lt;span class=&quot;n&quot;&gt;dtype&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;Category&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                         &lt;span class=&quot;s1&quot;&gt;&amp;#39;currency&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                         &lt;span class=&quot;s1&quot;&gt;&amp;#39;sellerRating&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                         &lt;span class=&quot;s1&quot;&gt;&amp;#39;Duration&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                         &lt;span class=&quot;s1&quot;&gt;&amp;#39;ClosePrice&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                         &lt;span class=&quot;s1&quot;&gt;&amp;#39;OpenPrice&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                         &lt;span class=&quot;s1&quot;&gt;&amp;#39;Competitive?&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
                  &lt;span class=&quot;n&quot;&gt;usecols&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;Category&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;currency&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;sellerRating&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;Duration&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;ClosePrice&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;OpenPrice&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;Competitive?&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
     &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dropna&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h4 id=&quot;Test&quot;&gt;Test&lt;a class=&quot;anchor-link&quot; href=&quot;#Test&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;Before streaming data from the whole file, let's first test using one data point. Note that in the orginal data, there is no timestamp, so I am adding the timestamp , i.e &lt;code&gt;DateTime&lt;/code&gt; column, to the dictionary. In your case, you may not want to do that. comment it out if you want to stream the data as is.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;DateTime&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isoformat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;output_wrapper&quot;&gt;
&lt;div class=&quot;output&quot;&gt;

&lt;div class=&quot;output_area&quot;&gt;



&lt;div class=&quot;output_text output_subarea output_execute_result&quot;&gt;
&lt;pre&gt;{&amp;#39;Category&amp;#39;: &amp;#39;Music/Movie/Game&amp;#39;,
 &amp;#39;currency&amp;#39;: &amp;#39;US&amp;#39;,
 &amp;#39;sellerRating&amp;#39;: 3249.0,
 &amp;#39;Duration&amp;#39;: 5.0,
 &amp;#39;ClosePrice&amp;#39;: 0.01,
 &amp;#39;OpenPrice&amp;#39;: 0.01,
 &amp;#39;Competitive?&amp;#39;: 0.0,
 &amp;#39;DateTime&amp;#39;: &amp;#39;2023-01-13T13:44:05.740998&amp;#39;}&lt;/pre&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;https://api.powerbi.com/beta/xxxxxxx/datasets/xxxxxxxxxx&amp;quot;&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;StreamToPowerBI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;output_wrapper&quot;&gt;
&lt;div class=&quot;output&quot;&gt;

&lt;div class=&quot;output_area&quot;&gt;



&lt;div class=&quot;output_text output_subarea output_execute_result&quot;&gt;
&lt;pre&gt;&amp;lt;Response [200]&amp;gt;&lt;/pre&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;&lt;div class=&quot;flash&quot;&gt;
    &lt;svg class=&quot;octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info octicon octicon-info&quot; viewBox=&quot;0 0 14 16&quot; version=&quot;1.1&quot; width=&quot;14&quot; height=&quot;16&quot; aria-hidden=&quot;true&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;M6.3 5.69a.942.942 0 01-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 01-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z&quot;&gt;&lt;/path&gt;&lt;/svg&gt;
    &lt;strong&gt;Note: &lt;/strong&gt;Note that the API endpoint Power BI provides includes the key so never share the endpoint with anyone. If you do, they will be able to stream the data without any authentication !
&lt;/div&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;If the reponse returned is &lt;code&gt;&amp;lt;Response [200]&amp;gt;&lt;/code&gt;, it was successful. We can now stream more data.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Streaming-Rows&quot;&gt;Streaming Rows&lt;a class=&quot;anchor-link&quot; href=&quot;#Streaming-Rows&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;To stream the rows, we will just iterate over the dataframe and send one row at a time with the specified delay.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h4 id=&quot;To-stream-the-entire-file&quot;&gt;To stream the entire file&lt;a class=&quot;anchor-link&quot; href=&quot;#To-stream-the-entire-file&quot;&gt; &lt;/a&gt;&lt;/h4&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;#including datetime is optional. If you do want it, make sure it&amp;#39;s included in the streaming dataset defintion in Power BI service&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;DateTime&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isoformat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;StreamToPowerBI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h3 id=&quot;To-randomly-stream-x%-of-the-data&quot;&gt;To randomly stream x% of the data&lt;a class=&quot;anchor-link&quot; href=&quot;#To-randomly-stream-x%-of-the-data&quot;&gt; &lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Remember the purpose here is POC so don't stream all the rows (read the documentation for limtations, especially the limitations on number of datapoints, no of requests etc.). You can use below to randomly sample x % of the rows from the dataframe.&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;
&lt;div class=&quot;input&quot;&gt;

&lt;div class=&quot;inner_cell&quot;&gt;
    &lt;div class=&quot;input_area&quot;&gt;
&lt;div class=&quot; highlight hl-ipython3&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;record&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;sample&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frac&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;dict&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;df&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;iloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
    
    &lt;span class=&quot;c1&quot;&gt;#including datetime is optional. If you do want it, make sure it&amp;#39;s included in the streaming dataset defintion in Power BI service&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;DateTime&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;datetime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;now&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;isoformat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    
    &lt;span class=&quot;n&quot;&gt;StreamToPowerBI&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;endpoint&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;wait&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

    &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h3 id=&quot;Resources&quot;&gt;Resources&lt;a class=&quot;anchor-link&quot; href=&quot;#Resources&quot;&gt; &lt;/a&gt;&lt;/h3&gt;&lt;ol&gt;
&lt;li&gt;Documentation : &lt;a href=&quot;https://learn.microsoft.com/en-us/power-bi/connect-data/service-real-time-streaming&quot;&gt;https://learn.microsoft.com/en-us/power-bi/connect-data/service-real-time-streaming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Example datasets: &lt;a href=&quot;https://github.com/reisanar/datasets&quot;&gt;https://github.com/reisanar/datasets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Azure Open Datasets : &lt;a href=&quot;https://github.com/Azure/OpenDatasetsNotebooks/&quot;&gt;https://github.com/Azure/OpenDatasetsNotebooks/&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Fixing the Power BI Deployment Pipeline Error For Migrated Tabular Model With RLS</title><link href="https://pawarbi.github.io/blog/powerbi/tabulareditor/rls/2022/12/20/tabular-model-rls-deployment-pipeline.html" rel="alternate" type="text/html" title="Fixing the Power BI Deployment Pipeline Error For Migrated Tabular Model With RLS" /><published>2022-12-20T00:00:00-06:00</published><updated>2022-12-20T00:00:00-06:00</updated><id>https://pawarbi.github.io/blog/powerbi/tabulareditor/rls/2022/12/20/tabular-model-rls-deployment-pipeline</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/tabulareditor/rls/2022/12/20/tabular-model-rls-deployment-pipeline.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2022-12-20-tabular-model-rls-deployment-pipeline.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;The-Issue&quot;&gt;The Issue&lt;a class=&quot;anchor-link&quot; href=&quot;#The-Issue&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;I recently completed a project where we migrated Analysis Services models to Power BI Premium datasets. Since Power BI datasets are nothing but AS tabular models, it's easy to copy/paste (manually or using C# scripts) tabular model objects such as relationships, measures, calculated columns, hierarchies, RLS roles etc. Everything went smoothly except when we set up deployment pipelines for CI/CD, it failed with an error that gave no clue why it was failing. We created a support ticket with Microsoft but they were stumped as well. They suggested using Large Dataset Format to resolve the error but that did not work. But after several tests, I figured out the issue.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://community.powerbi.com/t5/image/serverpage/image-id/351462i0F2CF0A2044FD0ED/image-size/large?v=v2&amp;amp;px=999&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;The-Solution&quot;&gt;The Solution&lt;a class=&quot;anchor-link&quot; href=&quot;#The-Solution&quot;&gt; &lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;The solution was simple: &lt;strong&gt;Change the Model Permission from &lt;code&gt;Administrator&lt;/code&gt; to &lt;code&gt;Read&lt;/code&gt;&lt;/strong&gt;. The original model had Administrator role defined for one of the roles. When the object properties were copied, I copied everything along with the associated metadata. For a Power BI dataset, the security roles and access are defined in the service and not in the Power BI dataset. If you keep the Model Permission as &lt;code&gt;Administrator&lt;/code&gt;, the Power BI dataset still works and refreshes fine but the Deployment Pipeline will fail. Don't ask me how long it took to figure this out!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/AS_deployment_rls.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry><entry><title type="html">Data Science For Power BI Developers</title><link href="https://pawarbi.github.io/blog/powerbi/machinelearning/datascience/2022/11/09/data-science-for-powerbi-developers.html" rel="alternate" type="text/html" title="Data Science For Power BI Developers" /><published>2022-11-09T00:00:00-06:00</published><updated>2022-11-09T00:00:00-06:00</updated><id>https://pawarbi.github.io/blog/powerbi/machinelearning/datascience/2022/11/09/data-science-for-powerbi-developers</id><content type="html" xml:base="https://pawarbi.github.io/blog/powerbi/machinelearning/datascience/2022/11/09/data-science-for-powerbi-developers.html">&lt;!--
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: _notebooks/2022-11-09-data-science-for-powerbi-developers.ipynb
--&gt;

&lt;div class=&quot;container&quot; id=&quot;notebook-container&quot;&gt;
        
    
    
&lt;div class=&quot;cell border-box-sizing code_cell rendered&quot;&gt;

&lt;/div&gt;
    

&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;h2 id=&quot;Motivation&quot;&gt;Motivation&lt;a class=&quot;anchor-link&quot; href=&quot;#Motivation&quot;&gt; &lt;/a&gt;&lt;/h2&gt;&lt;p&gt;I have presented on many topics related to Machine Learning, Data Science, Azure ML, AI Visuals in Power BI but I have always wanted to present how a Power BI developer can use data science in their workflow. The common misconception is that you have to know a ton of Statistics to use data science principles. While it will always help, that's not a requirement to get started. The difference between a BI developer and a data scientist is essentially how they analyze the data to get differrent insights. In this session I show what that approach looks like from a Power BI developer's perspective, common tasks/use cases in data science and how to get started. As a Power BI developer you will be able to enrich your reports with additional insights that you won't otherwise won't without data science.&lt;/p&gt;
&lt;p&gt;Thank you to Teo, Damu and others for inviting me to present.

&lt;center&gt;
    &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.youtube.com/embed/S8o8UFaTo70&quot; frameborder=&quot;0&quot; allowfullscreen=&quot;&quot;&gt;&lt;/iframe&gt;
&lt;/center&gt;
&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;cell border-box-sizing text_cell rendered&quot;&gt;&lt;div class=&quot;inner_cell&quot;&gt;
&lt;div class=&quot;text_cell_render border-box-sizing rendered_html&quot;&gt;
&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pawarbi/blog/master/images/srenamecol1.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><author><name></name></author><summary type="html"></summary></entry></feed>