Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi ,
Can you anyone let me know how to build selectionId in table visual or direct me to its Source code.
Solved! Go to Solution.
@v-viig Hi Ignat,
I already shared you my complete source code to your messages can you please check that and give me reply.
Hello @chotu27
Code has been updated. Please take a llok at the private message.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Please use this code as an example and current workaround:
getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] { return dataView.table.identity.map((identity: DataViewScopeIdentity) => { const categoryColumn: DataViewCategoryColumn = { source: dataView.table.columns[0], values: null, identity: [identity] }; return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); }); }
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hi Ignat
I tried to create selection id's with the workaround that you have sent. But its not working. The code just breaks at
return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); });
statement giving no errors. I do not know how createSelectionIdBuilder is working. Please help
Hello @chotu27
Can you share source code? It that possible?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hi @v-viig
I can share you apart of it.
Here is the source code
Everything else seems to be working fine. It is only at that line where i am trying to create selection id's is what's not working.
//function for dataModelling public visualTransform(options: VisualUpdateOptions, host: IVisualHost):TableBarViewModel { let iValueFormatterPercent = ValueFormatter.create({ format: "0 %;-0%;0%" }); var dataViews =this.dataView = options.dataViews[0]; let tableSelectionId: ISelectionId[] = this.getSelectionIds(dataViews,host); //selection id function public getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] { return dataView.table.identity.map((identity: DataViewScopeIdentity) => { const categoryColumn: DataViewCategoryColumn = { source: dataView.table.columns[0], values: null, identity: [identity] }; return host.createSelectionIdBuilder() .withCategory(categoryColumn, 0) .createSelectionId(); }) }; capabilities.json "dataRoles": [ { "displayName": "Values", "name": "values", "kind": "GroupingOrMeasure" } ], "dataViewMappings": [ { "conditions": [ { "values": { "min": 1, "max": 25 } } ], "table": { "rows": { "select": [{"for": { "in": "values" }}] } } } ],
This code works well for me.
Are you sure that another part of the code works properly?
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
@v-viig Hi Ignat,
I already shared you my complete source code to your messages can you please check that and give me reply.
Hello @chotu27
Code has been updated. Please take a llok at the private message.
Ignat Vilesov,
Software Engineer
Microsoft Power BI Custom Visuals
Hello,
Could you please share with me your code?
Hello,
I see that selection for table requires some hack.
Hopefully, a new API 2.5 which will be released next week contains .withTable method of the builder that must solve selection issues with Table mapping.
Kind Regards,
Evgenii Elkin,
Software Engineer
Microsoft Power BI Custom Visuals
pbicvsupport@microsoft.com
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
6 | |
4 | |
2 | |
2 |
User | Count |
---|---|
4 | |
4 | |
3 | |
3 | |
3 |