Forum Discussion
set value field in report powerbi by custom visual
- 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
Yes, 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
What confuses me is that data I need to filter contains 5 string (and some more numeric) columns and 25-30000 rows. Primary key is those 5 string columns and user can select up to 15000 rows to display. And If I choose to use JSON Filter, I would probably need to use IAdvancedFilter with 5 'in' conditions each of which 'values' field contains up to 15000 elements string array. Would it be the best way to filter from performance standpoint?
Upd: I went ahead and attempted to implemented advanced filter with 5 'in' conditions and figured out that it doesn't support this type of condition. And basic filter can filter only one category..
Upd2: And advanced filter as well