Forum Discussion
rsathish_red
8 years agoFrequent Visitor
set default value to power bi filter dropdown.
Hi. I have filters in reports (See attached screehshot) I need to set default value for the dropdown values so the end user will see the report for the selected values. Still they can see oth...
v-jiascu-msft
Microsoft Employee
8 years agoHi rsathish_red,
How did you pass the value "Asian"?
We can just make a selection in the slicer and SAVE the report then we can share the report with a default selection. Is this good enough?
Best Regards,
Dale
rsathish_red
8 years agoFrequent Visitor
I passed variable through the BasicFilter option. See below code
const basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: "2009 sample V2",
column: "Ethnicity"
},
operator: "In",
values: ['Asian']
}
iframe.onload = function () {
var msgJson = {
"method": "POST",
"url": "/report/load",
"headers": { ... },
"body": {
"settings": {
"filterPaneEnabled": false,
"navContentPaneEnabled": false
},
"filters":[basicFilter],
"type": "report",
"tokenType": 1,
"accessToken": txtAccessToken,
"embedUrl": txtEmbedUrl,
"id": txtEmbedReportId,
"permissions": 7,
}
};
iframe.contentWindow.postMessage(msgJson, "*");We are using Angular js as frondend to show Reports. It will be dynamic so we need to pass the values while displaying report.
You mentioned about Slicer. Will it be possible to pass it through JS?
- v-jiascu-msft8 years ago
Microsoft Employee
Hi rsathish_red,
It's normal sharing in my previous post. Seems you passed the filters, but it should be slicers. It's possible. Please refer to https://github.com/Microsoft/PowerBI-JavaScript/wiki/Slicers and the live demo.
Best Regards,
Dale