Quantcast
Channel: Developer topics
Viewing all articles
Browse latest Browse all 17884

Power BI Report level Filters not working properly in ASP.NET MVC application

$
0
0

Hi All,

My ASP.NET MVC application's URL use three parameters, that is Region, Subregion and Pagenumber from Power BI basic filter. When I run application which gives right results for Region and Pagenumber, but nothing showing for Subregion. My code has given below. I can't figure it out what is wrong here. Help will be appreciated

 

// for region ,subregion and page level filtering
for (var i = 0; i < hashes.length; i++) {

hash = hashes[i].split('=');
if (hash[0] == "region") {
region.push(hash[1]);
}

if (hash[0] == "subregion") {
subRegion.push(hash[1]);
}

if (hash[0] == "page") {
defaultPage = "ReportSection" + hash[1];
}
}


if (region[0] == undefined) {
region = [];
region.push("VNW","VMP","VGW","VGN","VGE","SOA","QLD","Other","Office","NSW","Display");
}


if (subRegion[0] == undefined) {
subRegion = [];
subRegion.push("VNW","VMW","VMP","VMN","VME","VIC","VCW","VCS","VCN","SOA","QLD","Other","NSW","Display");
}
const filterRegion = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Region Lookup",
column: "Region"
},
operator: "In",
values: region
};

const filterSubRegion = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "Sub Region Lookup",
column: "Sub Region"
},
operator: "In",
values: subRegion

};

// Embed configuration used to describe the what and how to embed.
// This object is used when calling powerbi.embed.
// This also includes settings and options such as filters.
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
var config = {
type: 'report',
tokenType: models.TokenType.Embed,
accessToken: accessToken,
embedUrl: embedUrl,
id: embedReportId,
permissions: models.Permissions.All,
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false
},
pageName: defaultPage,
filters: [filterRegion, filterSubRegion]
};
// Get a reference to the embedded report HTML element
var reportContainer = $('#reportContainer')[0];
// Embed the report and display it within the div container.
var report = powerbi.embed(reportContainer, config)

 

Thank You


Viewing all articles
Browse latest Browse all 17884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>