Skip to content

Objects

JChamboredon edited this page Sep 29, 2023 · 2 revisions

Power BI objects

The objects currently available in python-pbi to manipulate Power BI reports are the following:

Pbi

This class is used to interact with the Power BI service and to store the configuration. It is currently holding the following:

  • 'config': A configuration dictionary;
  • download_folder: The folder to download the Power BI reports into from the service;
  • upload_folder: The folder holding the Power BI reports to upload to the service.

PbiReport

This class represents the Power BI report itself, with all the report-level attributes (connections, filters, etc.). It consists of the folling:

  • achive_format: 'zip';
  • connections: A dictionary holding dataset information;
  • ext: pbix;
  • filename: The name of the Power BI file (without extension) to save as;
  • filters: A list of PbiFilter objects (the report-level filters);
  • folder: The folder to save this file into;
  • layout: A PbiLayout object;
  • temp_folder: A temporary folder to use to unzip the Power BI file.

PbiLayout

An object holding all the specific information about the report layout:

  • 'id': A number, e.g. 3001718;
  • 'reportId': A number, e.g. 1398730;
  • 'resourcePackages': A list of resource packages;
  • 'sections': A list of PbiPage objects;
  • 'config': A PbiConfig object;
  • 'layoutOptimization': 0or1`;
  • 'publicCustomVisuals': A list.

PbiPage

This corresponds to a page in the Power BI report, also called section. Its structure is as below:

  • 'name': The Power BI internal name for the page, starting with 'ReportSection', e.g. 'ReportSection914cd860e217720387dd';
  • 'displayName': The page name shown in the Power BI app or service, e.g. 'Page 1';
  • 'filters': A list of PbiFilter objects (the page-level filters);
  • 'ordinal': An integer, e.g. 1;
  • 'visualContainers': A list of PbiContainer objects;
  • 'config': A PbiConfig object;
  • 'displayOption': 0 or 1;
  • 'width': The page canvas width in pixels, e.g. 1280;
  • 'height': The page canvas height in pixels, e.g. 720;

PbiContainer

This is the base container class, describing all objects on a Power BI page layout (slicers, visuals, etc.) It has the following information:

  • 'id': A number, e.g. 495217558;
  • 'x': A number, e.g. 180.91680814940577;
  • 'y': A number, e.g. 679.660441426146;
  • 'z': A number, e.g. 6000;
  • 'width': A number, e.g. 168.69269949066214;
  • 'height': A number, e.g. 40.33955857385399;
  • 'config': A PbiConfig object;
  • 'filters': A list of PbiFilter objects (the visual-level filters);
  • 'tabOrder': A number, e.g. 6000.

PbiFilter

A class representing the Power BI filters. These can be at report level, page level, or visual level.

PbiConfig

This class is used by many objects (visuals, pages, etc.) and holds most of their configuration (style, options, etc.)

Bookmark

This class corresponds to the report bookmarks.

Clone this wiki locally