Power BI App scripting
- Last UpdatedJul 18, 2024
- 2 minute read
The Power BI App enables scripting capabilities at the Power BI report and page level. The Power BI App supports scripts that incorporate methods and their parameters as well as Power BI App properties. Script statements can be specified using the MyContent Namespace format in layout scripting by the following syntax formats:
MyContent.name of the PowerBI App instance.PowerBIApp_Method(parameter_1, parameter_2, parameter_n);
or
MyContent.name of the PowerBI App instance.PowerBIApp_Property = xxx
Power BI App properties in layout scripts
The following table lists Power BI App properties as they appear in the Properties page of Layout and ViewApp editors and how they are specified in layout scripting. Notice that property names in layout scripting are single words without blank spaces.
|
Power BI App property |
Layout script editor |
Layout scriptable (Yes/No) |
|---|---|---|
|
Workspace ID |
WorkspaceID |
Yes |
|
Report ID |
ReportID |
Yes |
|
Show Filter Pane |
ShowFilterPane |
Yes |
|
Page Navigation |
PageNavigation |
Yes |
|
Active Page |
ActivePage |
Yes |
|
Authentication |
Authentication |
Yes |
|
StyleSheet |
StyleSheet |
Yes |
|
Transparent Background |
TransparentBackground |
No |
|
Display Option |
DisplayOption |
yes |
|
Contrast Mode |
ContrastMode |
Yes |
When embedding a Power BI report in the Power BI App, you can specify scripts whose methods apply filters during the loading phase. You can also change filters dynamically after a Power BI report is loaded. For example, you can create your own custom filter to match the brand of your application display asset specific data, and automatically apply filters to reports. You can also create button graphics that users select during runtime to apply filters to an embedded report in the Power BI App.
Power BI App script methods
There are four types of script methods that filter data at the report or page level. Multiple filters of any type can be applied to a Power BI report
-
A basic filter has a single operator with one or more values.
-
An filter has a single logical operator and one or two conditions that have their own operator and value.
Note: Do not specify more than two conditions when building an advanced filter. More than two conditions may cause undefined behavior.
-
Relative date Filter
-
Relative time Filter
The following list shows script operations around report filtering.
-
Set filters
-
Clear filters
-
Update filters