We are creating Visuals using Power BI API Client(JavaScript).Once it is created I want to pre populate all selected Capabilities and filters in another view.I used Visual.getFilters() method to get all pre selected filters but in each item I am not getting the capability to which it belongs,Is there is any way to get capability name with each filter. for example
I selected bellow properties for creating a visual
Visual Type = Funnel
Capabilities
1 Group = Group1
2 Values = value1
after saving this visual when we execute getFilters(),we are getting this two objects but it does not contains Capability names like Group/Values
It is not possible to get the capability names in each filter using getFilters()
, we can get the Capability Names by using getCapabilities
. To get the capability names, follow the below steps:
window.authoringPage = await report.addPage(pageName);
Create a visual
API:const createVisualResponse = await page.createVisual('Visual_Name');
const visual = createVisualResponse.visual;
getFilters()
:const filters = await visual.getFilters();
We didn't get capabilities of each filter in filters object
getCapabilities
:const capabilities = await visual.getCapabilities();
Find the references and the sample code here: https://learn.microsoft.com/javascript/api/overview/powerbi/report-authoring-overview https://learn.microsoft.com/javascript/api/overview/powerbi/create-add-visual https://learn.microsoft.com/javascript/api/overview/powerbi/get-visual-capabilities