Open andresud opened 2 years ago
@andresud were you able to come up with a solution? I'm facing the problem now. Thanks
I'm also trying to figure out how to do this. In my case, I want to filter the Power BI Visual by Account.Id. I've modified the LWC so that it receives the account Id from the record page I've placed the component on. At I modified the Apex Controller to pass a filter parameter on the Rest API URL, but that didn't work.
I was able to get it to work by modifying the JS file in the LWC. I added this filter variable const basicFilter = { $schema: "http://powerbi.com/product/schema#basic", target: { table: "Payment Gaps", column: "Customer__c" }, operator: "In", values: [this.recordId] };
and referenced it in the config var config = { type: 'report', id: reportId, embedUrl: embedUrl, accessToken: token, tokenType: 1, filters: [basicFilter], settings: { panes: { filters: { expanded: false, visible: true }, pageNavigation: { visible: false } } } }; (sorry for the lack of formatting) Now when I view that embedded report, it correctly shows the data only for that customer.
@cplewis I have a similar requirement to filter the Power BI Report by Account Id. I modified the JS file with the filter like above. Modified the apex class to filter the url String urlGetReport = 'https://api.powerbi.com/v1.0/myorg/groups/' + WorkspaceId + '/reports/' + ReportId + '/?$filter ='+ basicFilter; Getting a bad request error. What am I missing here. Any ideas.
I'm trying to get the report filtered before loaded. I tried two aproaches:
Filtered in the URL like this: URL/?filter=table/column+in+(%27USERID%27)'; and Javascript filter: const filter = { $schema: "http://powerbi.com/product/schema#basic", target: { table: "tableName", column: "columnName" }, operator: "In", values: ["USERID"] };
None of them worked, any ideas?