Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by watching the DP-600 session on-demand now through April 28th.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I have a powerbi embedded report that works fine -it renders as a table with a few columns . I would like to be able to click a row in the table and see the data related to that row. I have tried to utilise dataSelected:
(
<script>
$(function() {
var reportConfig = {
settings: {
filterPaneEnabled: false,
navContentPaneEnabled: false,
dataSelectedEnabled: true
}
};
var reportElement = document.getElementById('pbi-report');
var pageName = document.getElementById('page-name');
// Embed report
var report = powerbi.embed(reportElement, reportConfig);
var pages = [];
var pageIndex = 0;
var currentPage = null;
report.on('loaded',
function() {
report.getPages()
.then(function (reportPages) {
pages = reportPages;
});
});
report.on("dataSelected", function (event) {
var data = event.detail;
console.log(data);
});
report.on('pageChanged',
function(e) {
currentPage = e.detail.newPage;
//pageName.innerText = e.detail.newPage.displayName;
if (pages.length === 0) {
return;
}
pageIndex = pages.findIndex(function(el) {
return el.name === e.detail.newPage.name;
});
});
function changePage(direction) {
var nextPageIndex = pageIndex + direction;
if (nextPageIndex < 0) nextPageIndex = pages.length - 1;
if (nextPageIndex >= pages.length) nextPageIndex = 0;
pages[nextPageIndex].setActive();
}
function addFilter() {
var target = $('#filter-target').val();
var table = $('#filter-table').val();
var column = $('#filter-column').val();
var value = $('#filter-value').val();
var basicFilter = {
$schema: "http://powerbi.com/product/schema#basic",
target: {
table: table,
column: column
},
operator: 'In',
values: [value]
};
var filterTarget = target === 'page' ? currentPage : report;
filterTarget.getFilters().then(function(allTargetFilters) {
allTargetFilters.push(basicFilter);
filterTarget.setFilters(allTargetFilters);
});
$('#filter-form')[0].reset();
}
function clearFilters() {
report.removeFilters();
pages.forEach(function(page) {
page.removeFilters();
});
}
function updateSetting(e, settingName) {
var settings = {};
settings[settingName] = e.target.checked;
report.updateSettings(settings);
}
});
</script>
and followed https://microsoft.github.io/PowerBI-JavaScript/demo/dataselection.html to the best of my ability. But I'm getting nothing firing when I click on a row. what am I missing? Any help appreciated.
Solved! Go to Solution.
What visual do you click on? Based on my test, the Table and Matrix visual seem not having the dataSelected event. On other visuals, the dataSelected event can be fired.
report.on("dataSelected", function (event) {
var data = event.detail;
console.log(JSON.stringify(data));
});
the data JSON string
{
"report":{
"id":"719c43ad-xxx-4xxx9-8xx4-f79exxxxc1a6",
"displayName":"Pyrxxxxple"
},
"page":{
"name":"ReportSection",
"displayName":"Sample Dashboard"
},
"visual":{
"name":null,
"title":"Count of Opportunity by Region",
"type":"pieChart"
},
"dataPoints":[
{
"identity":[
{
"target":{
"table":"Account",
"column":"Region"
},
"equals":"Central"
}
],
"values":[
{
"value":null
}
]
}
],
"regions":null,
"filters":[
]
}
So far, it is not possible to get the values, the data json doesn't have values at the moment and the PG team is working on it. Check this link.
What visual do you click on? Based on my test, the Table and Matrix visual seem not having the dataSelected event. On other visuals, the dataSelected event can be fired.
report.on("dataSelected", function (event) {
var data = event.detail;
console.log(JSON.stringify(data));
});
the data JSON string
{
"report":{
"id":"719c43ad-xxx-4xxx9-8xx4-f79exxxxc1a6",
"displayName":"Pyrxxxxple"
},
"page":{
"name":"ReportSection",
"displayName":"Sample Dashboard"
},
"visual":{
"name":null,
"title":"Count of Opportunity by Region",
"type":"pieChart"
},
"dataPoints":[
{
"identity":[
{
"target":{
"table":"Account",
"column":"Region"
},
"equals":"Central"
}
],
"values":[
{
"value":null
}
]
}
],
"regions":null,
"filters":[
]
}
So far, it is not possible to get the values, the data json doesn't have values at the moment and the PG team is working on it. Check this link.
Thanks for the reply - yes I was using a table as the visual. I will check your link, thanks again.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |