Forum Discussion
marcobaciga
Helper I
8 years agoset value field in report powerbi by custom visual
Hi, I must in m y custom visual to send a value like filter in each visual object in my report powerbi when i click a icon. Is it possible? Thank you Marco
- 8 years ago
This code snippet is going to address the issue:
let selectionIds = []; selectionIds.push(host.createSelectionIdBuilder() .withCategory(categorical.categories[0], 0) .createSelectionId() ); selectionIds.push(host.createSelectionIdBuilder() .withCategory(categorical.categories[1], 0) .createSelectionId() ); selectionIds.push(host.createSelectionIdBuilder() .withCategory(categorical.categories[0], 1) .createSelectionId() ); selectionIds.push(host.createSelectionIdBuilder() .withCategory(categorical.categories[1], 1) .createSelectionId() ); selectionIds.forEach((selectionId) => { this.selectionManager.select(selectionId, true) });Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
seregindv
7 years agoFrequent Visitor
I just want to implement the same behavior as SampleSlicer has in the bottom part: show list of possible values, where some of them can be checked and all unchecked filtered out.
Is JSON filter suitable for this task? I though it is primarily intended to be used for range filters and I need to use something different that allows to select discrete values..
v-viig
Community Champion
7 years agoYes, JSON Filter can be used to filter data. In your case you shoould use BasicFilter.
You can find details in powerbi-models documentation.
const basicFilter: models.IBasicFilter = { target: { table: "Products", column: "Version" }, operator: "In", values: [ 1, 2, 3, 4 ] };
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals