Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running the notebook fails at different places #16

Closed
RonaiBertalan opened this issue Jun 4, 2021 · 1 comment
Closed

Running the notebook fails at different places #16

RonaiBertalan opened this issue Jun 4, 2021 · 1 comment

Comments

@RonaiBertalan
Copy link

Hi!
I have tried running a notebook based on the wiki and the announcement page (using device auth) and on one computer it can embed the report but fails after running the get_filters code. On the other computer with the same notebook in 4 tries it could only once embed the report and the kernel dies. In both cases Anaconda was updated to the latest and the notebooks are strong machines.

``
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# Import Report class and models\n",
"from powerbiclient import Report, models\n",
"import pandas as pd\n",
"# Import DeviceCodeLoginAuthentication class to authenticate to Power BI\n",
"from powerbiclient.authentication import DeviceCodeLoginAuthentication"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Performing interactive authentication. Please follow the instructions on the terminal.\n",
" To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code DET2UAPZW to authenticate.\n",
"You have logged in.\n",
"Interactive authentication successfully completed.\n"
]
}
],
"source": [
"# Initiate device authentication\n",
"device_auth = DeviceCodeLoginAuthentication()\n",
"\n",
"# Get access token from auth object\n",
"access_token = device_auth.get_access_token()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "6e6e49334169493aad4821e8c91d7dff",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Report()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Set workspace Id and report Id\n",
"group_id="2c411c27-e41d-4d77-8c1b-c087fb6744ec"\n",
"report_id="aaae5a96-3e0d-4709-a727-9dd5e62f4509"\n",
"\n",
"# Create an instance of Power BI Report (Use either of the below instances)\n",
"# Use auth object\n",
"report = Report(group_id=group_id, report_id=report_id, auth=device_auth)\n",
"\n",
"# Use access token from device authentication\n",
"report = Report(group_id=group_id, report_id=report_id, access_token=access_token, token_type=models.TokenType.AAD.value)\n",
"\n",
"# Load the report in the output cell\n",
"report"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"report.set_dimensions(800, 1100)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'name': 'ReportSection1ef29e413d069478ab55',\n",
" 'displayName': 'Bar and column',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectiond8b7c2eb140ac63223c0',\n",
" 'displayName': 'Matrix',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionf7a8e1b14d9ab030c5ed',\n",
" 'displayName': 'Matrix Details',\n",
" 'isActive': False,\n",
" 'visibility': 1,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection0b7bb46c903b8ec5de08',\n",
" 'displayName': 'Line Charts',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection98b20e874029520bada9',\n",
" 'displayName': 'Pie Donut Charts',\n",
" 'isActive': True,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection86a83f5b4e955e81e232',\n",
" 'displayName': 'KPI Card and Gauge',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection9be595fc50d900312a2b',\n",
" 'displayName': 'Maps',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection7ee2636508467a9cb665',\n",
" 'displayName': 'Sales Tooltip',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'width': 320, 'height': 240},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionbd579275497cd0a23b79',\n",
" 'displayName': 'ArcGIS Map',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection519fb7909a3879a736a7',\n",
" 'displayName': 'Time Intelligence',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionca74ca96ba2cca3b2de1',\n",
" 'displayName': 'Smart Narratives',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection022294dfd722ac1c09d0',\n",
" 'displayName': 'Waterfall Chart',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSection38574311eb5a78276dce',\n",
" 'displayName': 'Ribbon Slicer filters',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectionf7488c4d9e48e01a207a',\n",
" 'displayName': 'Percentage',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0},\n",
" {'name': 'ReportSectione196bfddc0ed64c0a685',\n",
" 'displayName': 'Conditional Formatting',\n",
" 'isActive': False,\n",
" 'visibility': 0,\n",
" 'defaultSize': {'type': 0, 'width': 1280, 'height': 720},\n",
" 'defaultDisplayOption': 0}]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pages = report.get_pages()\n",
"pages"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'name': '1dd4c239217de4004080',\n",
" 'title': 'Country sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 875.363748458693,\n",
" 'y': 0,\n",
" 'z': 0,\n",
" 'width': 131.3933415536375,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '183f798992ebbdc7a0eb',\n",
" 'title': 'Manufacturer sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 317.82983970406906,\n",
" 'y': 0,\n",
" 'z': 3000,\n",
" 'width': 165.12946979038225,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': 'ef3a420088062841a78a',\n",
" 'title': 'Channel sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 173.11960542540075,\n",
" 'y': 0,\n",
" 'z': 4000,\n",
" 'width': 134.05672009864364,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '7ff2944372857bc05308',\n",
" 'title': 'PBI logo',\n",
" 'type': 'image',\n",
" 'layout': {'x': 1026.0912453760789,\n",
" 'y': 0,\n",
" 'z': 1000,\n",
" 'width': 253.90875462392108,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '781a42009bb013cbba21',\n",
" 'title': 'ProdCategory',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 669.3958076448829,\n",
" 'y': 0,\n",
" 'z': 1000,\n",
" 'width': 191.7632552404439,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': 'de45e472e0edde6b8817',\n",
" 'title': 'Brand sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 493.612823674476,\n",
" 'y': 0,\n",
" 'z': 2000,\n",
" 'width': 165.12946979038225,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '842fbe1195501eb537a8',\n",
" 'title': 'Year-Month sl',\n",
" 'type': 'slicer',\n",
" 'layout': {'x': 0,\n",
" 'y': 0,\n",
" 'z': 5000,\n",
" 'width': 165.12946979038225,\n",
" 'height': 103.87176325524044,\n",
" 'displayState': {'mode': 0}}},\n",
" {'name': '344fe061214dca8e6566',\n",
" 'type': 'tableEx',\n",
" 'layout': {'x': 0,\n",
" 'y': 197.9778051787916,\n",
" 'z': 0,\n",
" 'width': 604.5869297163995,\n",
" 'height': 522.0221948212084,\n",
" 'displayState': {'mode': 0}}}]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"visuals = report.visuals_on_page('ReportSection519fb7909a3879a736a7')\n",
"visuals"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from io import StringIO"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"exported_data = report.export_visual_data('ReportSection519fb7909a3879a736a7', '344fe061214dca8e6566', rows=100, export_data_type=models.ExportDataType.SUMMARIZED.value)\n",
"dataexp=StringIO(exported_data)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"

\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border="1" class="dataframe">\n",
" \n",
" <tr style="text-align: right;">\n",
" \n",
" Year\n",
" Month\n",
" Sales\n",
" Sales YTD\n",
" Sales PY\n",
" Sales PY YTD\n",
" \n",
" \n",
" \n",
" \n",
" 0\n",
" 2007\n",
" January\n",
" 269835263 Ft\n",
" 269835263 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 1\n",
" 2007\n",
" February\n",
" 298215968 Ft\n",
" 568051232 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 2\n",
" 2007\n",
" March\n",
" 300486927 Ft\n",
" 868538158 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 3\n",
" 2007\n",
" April\n",
" 400160332 Ft\n",
" 1268698490 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 4\n",
" 2007\n",
" May\n",
" 423429128 Ft\n",
" 1692127618 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 5\n",
" 2007\n",
" June\n",
" 409797546 Ft\n",
" 2101925163 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 6\n",
" 2007\n",
" July\n",
" 389617372 Ft\n",
" 2491542536 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 7\n",
" 2007\n",
" August\n",
" 388429827 Ft\n",
" 2879972363 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 8\n",
" 2007\n",
" September\n",
" 379144600 Ft\n",
" 3259116962 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 9\n",
" 2007\n",
" October\n",
" 423213241 Ft\n",
" 3682330203 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 10\n",
" 2007\n",
" November\n",
" 453750209 Ft\n",
" 4136080412 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 11\n",
" 2007\n",
" December\n",
" 425860543 Ft\n",
" 4561940955 Ft\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 12\n",
" 2008\n",
" January\n",
" 279460807 Ft\n",
" 279460807 Ft\n",
" 269835263 Ft\n",
" 269835263 Ft\n",
" \n",
" \n",
" 13\n",
" 2008\n",
" February\n",
" 288852634 Ft\n",
" 568313441 Ft\n",
" 298215968 Ft\n",
" 568051232 Ft\n",
" \n",
" \n",
" 14\n",
" 2008\n",
" March\n",
" 290060561 Ft\n",
" 858374002 Ft\n",
" 300486927 Ft\n",
" 868538158 Ft\n",
" \n",
" \n",
" 15\n",
" 2008\n",
" April\n",
" 356139170 Ft\n",
" 1214513172 Ft\n",
" 400160332 Ft\n",
" 1268698490 Ft\n",
" \n",
" \n",
" 16\n",
" 2008\n",
" May\n",
" 351096953 Ft\n",
" 1565610125 Ft\n",
" 423429128 Ft\n",
" 1692127618 Ft\n",
" \n",
" \n",
" 17\n",
" 2008\n",
" June\n",
" 338132827 Ft\n",
" 1903742952 Ft\n",
" 409797546 Ft\n",
" 2101925163 Ft\n",
" \n",
" \n",
" 18\n",
" 2008\n",
" July\n",
" 386024198 Ft\n",
" 2289767150 Ft\n",
" 389617372 Ft\n",
" 2491542536 Ft\n",
" \n",
" \n",
" 19\n",
" 2008\n",
" August\n",
" 359938154 Ft\n",
" 2649705304 Ft\n",
" 388429827 Ft\n",
" 2879972363 Ft\n",
" \n",
" \n",
" 20\n",
" 2008\n",
" September\n",
" 353421977 Ft\n",
" 3003127280 Ft\n",
" 379144600 Ft\n",
" 3259116962 Ft\n",
" \n",
" \n",
" 21\n",
" 2008\n",
" October\n",
" 326256368 Ft\n",
" 3329383648 Ft\n",
" 423213241 Ft\n",
" 3682330203 Ft\n",
" \n",
" \n",
" 22\n",
" 2008\n",
" November\n",
" 383063714 Ft\n",
" 3712447362 Ft\n",
" 453750209 Ft\n",
" 4136080412 Ft\n",
" \n",
" \n",
" 23\n",
" 2008\n",
" December\n",
" 398786173 Ft\n",
" 4111233535 Ft\n",
" 425860543 Ft\n",
" 4561940955 Ft\n",
" \n",
" \n",
" 24\n",
" 2009\n",
" January\n",
" 269770345 Ft\n",
" 269770345 Ft\n",
" 279460807 Ft\n",
" 279460807 Ft\n",
" \n",
" \n",
" 25\n",
" 2009\n",
" February\n",
" 266002676 Ft\n",
" 535773021 Ft\n",
" 288852634 Ft\n",
" 568313441 Ft\n",
" \n",
" \n",
" 26\n",
" 2009\n",
" March\n",
" 270769958 Ft\n",
" 806542979 Ft\n",
" 290060561 Ft\n",
" 858374002 Ft\n",
" \n",
" \n",
" 27\n",
" 2009\n",
" April\n",
" 309157751 Ft\n",
" 1115700730 Ft\n",
" 356139170 Ft\n",
" 1214513172 Ft\n",
" \n",
" \n",
" 28\n",
" 2009\n",
" May\n",
" 341560286 Ft\n",
" 1457261016 Ft\n",
" 351096953 Ft\n",
" 1565610125 Ft\n",
" \n",
" \n",
" 29\n",
" 2009\n",
" June\n",
" 331299979 Ft\n",
" 1788560995 Ft\n",
" 338132827 Ft\n",
" 1903742952 Ft\n",
" \n",
" \n",
" 30\n",
" 2009\n",
" July\n",
" 333374435 Ft\n",
" 2121935431 Ft\n",
" 386024198 Ft\n",
" 2289767150 Ft\n",
" \n",
" \n",
" 31\n",
" 2009\n",
" August\n",
" 325030343 Ft\n",
" 2446965774 Ft\n",
" 359938154 Ft\n",
" 2649705304 Ft\n",
" \n",
" \n",
" 32\n",
" 2009\n",
" September\n",
" 313780340 Ft\n",
" 2760746114 Ft\n",
" 353421977 Ft\n",
" 3003127280 Ft\n",
" \n",
" \n",
" 33\n",
" 2009\n",
" October\n",
" 326836388 Ft\n",
" 3087582502 Ft\n",
" 326256368 Ft\n",
" 3329383648 Ft\n",
" \n",
" \n",
" 34\n",
" 2009\n",
" November\n",
" 322166204 Ft\n",
" 3409748706 Ft\n",
" 383063714 Ft\n",
" 3712447362 Ft\n",
" \n",
" \n",
" 35\n",
" 2009\n",
" December\n",
" 330734413 Ft\n",
" 3740483119 Ft\n",
" 398786173 Ft\n",
" 4111233535 Ft\n",
" \n",
" \n",
"\n",
"
"
],
"text/plain": [
" Year Month Sales Sales YTD Sales PY Sales PY YTD\n",
"0 2007 January 269835263 Ft 269835263 Ft NaN NaN\n",
"1 2007 February 298215968 Ft 568051232 Ft NaN NaN\n",
"2 2007 March 300486927 Ft 868538158 Ft NaN NaN\n",
"3 2007 April 400160332 Ft 1268698490 Ft NaN NaN\n",
"4 2007 May 423429128 Ft 1692127618 Ft NaN NaN\n",
"5 2007 June 409797546 Ft 2101925163 Ft NaN NaN\n",
"6 2007 July 389617372 Ft 2491542536 Ft NaN NaN\n",
"7 2007 August 388429827 Ft 2879972363 Ft NaN NaN\n",
"8 2007 September 379144600 Ft 3259116962 Ft NaN NaN\n",
"9 2007 October 423213241 Ft 3682330203 Ft NaN NaN\n",
"10 2007 November 453750209 Ft 4136080412 Ft NaN NaN\n",
"11 2007 December 425860543 Ft 4561940955 Ft NaN NaN\n",
"12 2008 January 279460807 Ft 279460807 Ft 269835263 Ft 269835263 Ft\n",
"13 2008 February 288852634 Ft 568313441 Ft 298215968 Ft 568051232 Ft\n",
"14 2008 March 290060561 Ft 858374002 Ft 300486927 Ft 868538158 Ft\n",
"15 2008 April 356139170 Ft 1214513172 Ft 400160332 Ft 1268698490 Ft\n",
"16 2008 May 351096953 Ft 1565610125 Ft 423429128 Ft 1692127618 Ft\n",
"17 2008 June 338132827 Ft 1903742952 Ft 409797546 Ft 2101925163 Ft\n",
"18 2008 July 386024198 Ft 2289767150 Ft 389617372 Ft 2491542536 Ft\n",
"19 2008 August 359938154 Ft 2649705304 Ft 388429827 Ft 2879972363 Ft\n",
"20 2008 September 353421977 Ft 3003127280 Ft 379144600 Ft 3259116962 Ft\n",
"21 2008 October 326256368 Ft 3329383648 Ft 423213241 Ft 3682330203 Ft\n",
"22 2008 November 383063714 Ft 3712447362 Ft 453750209 Ft 4136080412 Ft\n",
"23 2008 December 398786173 Ft 4111233535 Ft 425860543 Ft 4561940955 Ft\n",
"24 2009 January 269770345 Ft 269770345 Ft 279460807 Ft 279460807 Ft\n",
"25 2009 February 266002676 Ft 535773021 Ft 288852634 Ft 568313441 Ft\n",
"26 2009 March 270769958 Ft 806542979 Ft 290060561 Ft 858374002 Ft\n",
"27 2009 April 309157751 Ft 1115700730 Ft 356139170 Ft 1214513172 Ft\n",
"28 2009 May 341560286 Ft 1457261016 Ft 351096953 Ft 1565610125 Ft\n",
"29 2009 June 331299979 Ft 1788560995 Ft 338132827 Ft 1903742952 Ft\n",
"30 2009 July 333374435 Ft 2121935431 Ft 386024198 Ft 2289767150 Ft\n",
"31 2009 August 325030343 Ft 2446965774 Ft 359938154 Ft 2649705304 Ft\n",
"32 2009 September 313780340 Ft 2760746114 Ft 353421977 Ft 3003127280 Ft\n",
"33 2009 October 326836388 Ft 3087582502 Ft 326256368 Ft 3329383648 Ft\n",
"34 2009 November 322166204 Ft 3409748706 Ft 383063714 Ft 3712447362 Ft\n",
"35 2009 December 330734413 Ft 3740483119 Ft 398786173 Ft 4111233535 Ft"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df=pd.read_csv(dataexp,sep=",")\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border="1" class="dataframe">\n",
" \n",
" <tr style="text-align: right;">\n",
" \n",
" Year\n",
" Month\n",
" Sales\n",
" Sales YTD\n",
" Sales PY\n",
" Sales PY YTD\n",
" \n",
" \n",
" \n",
" \n",
" 0\n",
" 2007\n",
" January\n",
" 269835263.0\n",
" 2.698353e+08\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 1\n",
" 2007\n",
" February\n",
" 298215968.0\n",
" 5.680512e+08\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 2\n",
" 2007\n",
" March\n",
" 300486927.0\n",
" 8.685382e+08\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 3\n",
" 2007\n",
" April\n",
" 400160332.0\n",
" 1.268698e+09\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
" 4\n",
" 2007\n",
" May\n",
" 423429128.0\n",
" 1.692128e+09\n",
" NaN\n",
" NaN\n",
" \n",
" \n",
"\n",
"
"
],
"text/plain": [
" Year Month Sales Sales YTD Sales PY Sales PY YTD\n",
"0 2007 January 269835263.0 2.698353e+08 NaN NaN\n",
"1 2007 February 298215968.0 5.680512e+08 NaN NaN\n",
"2 2007 March 300486927.0 8.685382e+08 NaN NaN\n",
"3 2007 April 400160332.0 1.268698e+09 NaN NaN\n",
"4 2007 May 423429128.0 1.692128e+09 NaN NaN"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[df.columns[2:]] = df[df.columns[2:]].replace('[ Ft,]','', regex=True).astype(float)\n",
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df.plot.barh(y="Sales", x="Year", figsize=(10,15))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"filters = report.get_filters()\n",
"filters"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Create a basic filter to filter the report with value "East" in column "Region" of table "Geo"\n",
"channel_filter = {\n",
" '$schema': "http://powerbi.com/product/schema#basic",\n",
" 'target': {\n",
" 'table': "Channel",\n",
" 'column': "Channel"\n",
" },\n",
" 'operator': "In",\n",
" 'values': ["Online"]\n",
"}\n",
"\n",
"# Apply the basic filter by passing it in a List of filters in update_filters() method\n",
"report.update_filters([channel_filter])\n",
"report"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

@bapat-atharva
Copy link
Contributor

Hi @RonaiBertalan,

A known issue with get_filters was fixed in the latest release. Please install the latest version and let us know if there are any other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants