Saturday, May 21, 2022
HomeBusiness IntelligenceUtilizing JavaScript For Energy BI Filters in PBRS

Utilizing JavaScript For Energy BI Filters in PBRS


One of the helpful options of PowerBI Stories is the power to set report-level filters in order that the knowledge displayed inside it may be related to the patron.

Using JavaScript For Filters in PBRS

What are Filters in Energy BI?

Filters in Energy BI distill and kind knowledge and data primarily based on a particular standards. That’s, you may choose explicit fields or values inside fields and think about solely the knowledge associated to that. As an example, in case you have a dataset associated to gross sales of a retailer, you should use Filters to view a report having solely the info for the chosen features.

For instance, if you happen to solely wish to see the gross sales data within the Charlotte space within the yr 2019, all you need to do is to place the filtering criterion as 2019 and Charlotte of their respective fields. The report of gross sales will instantly make modifications accordingly and solely present the graphs and visuals particular to gross sales statistics in Charlotte and within the yr 2019.

How Does PBRS Help Report-Degree Energy BI Filters?

PBRS has all the time supported passing report-level Filters to Energy BI experiences in order that when the report is routinely generated, it’s delivered with simply the correct data. In reality, PBRS customers love utilizing Information-Pushed subscription schedules to run a number of cases of Energy BI experiences, with filters configured by way of the data-driver after which delivered to knowledge pushed recipients, the ensuing exported output file containing solely the knowledge related to the recipient.

One problem that has all the time plagued the extra superior consumer, nevertheless, is when a Energy BI report comprises greater than a few filters to configure. Because the variety of report filters will increase, the method of organising the PBRS schedule shortly turns into tedious and susceptible to errors.

Within the September 2020 launch of PBRS, we addressed this downside by permitting our superior customers to configure their Energy BI Filters by way of JavaScript.

Utilizing Javascript To Configure PBRS Filters

As an alternative of spending a very long time manually coming into a single filter at a time, PBRS customers can now merely write the JavaScript perform of their favourite code editor (or in PBRS itself) after which reserve it as a part of the schedule. Moreover, the JavaScript perform will be saved ultimately consumer’s database and pulled into the schedule utilizing a data-driver insert.

Using Javascript To Configure PBRS Filters

How you can Assemble Energy BI Filters With JavaScript

Microsoft has detailed data on create Filter objects in JavaScript and this may be discovered right here:

https://github.com/Microsoft/PowerBI-JavaScript/wiki/Filters#contructingfilters

As soon as the filters have been created, the one requirement from PBRS is that it’s positioned inside a JavaScript perform that returns an array of all of the filters. An instance of this may be seen under.

Perform getFilters(){
let basicCustomerFilter = …..;
let advancedRegionFilter = ……;
let employeesFilter = …..;
return [basicCompanyFilter, advancedRegionFilter, employeesFilter]
}

Power BI Filter Array

With a view to streamline the creation of the filter perform for PBRS data-driven schedules, it is suggested to construct a SQL perform or Saved Process that accepts a key identifier and returns the complete perform. That is so that each one the logic will be modified in a single place and doesn’t must be created in an inline SQL question.

For instance:

SELECT dbo.Custumer.CustomerId, dbo.Buyer.EmailAddress, dbo.GetPowerBiFilterFunction(Buyer.CustomerId) AS PowerBiFilter FROM dbo.Buyer

With this question because the data-driver, the PowerBi Filter column can merely be dropped into the Filter JavaScript area.

Tell us in case you have any questions or ideas about this characteristic.

Tutorial: Information Pushed Subscription Scheduling for Energy BI

Get Options PDFBegin Free Trial

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments

x