Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join 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.

Reply
mikihiir
Helper III
Helper III

All possible report filter values in javascript api

Is is possbile to get all possible filter values, i wanted to get values selected and not selected values ?

1 ACCEPTED SOLUTION
Eric_Zhang
Microsoft Employee
Microsoft Employee

@mikihiir

 

Based on my test, we can only get the filter objects as in this wiki, NOT all values.

 

<html>

  <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>

<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
     

<script type="text/javascript">
window.onload = function () {
 
var embedConfiguration = {
    type: 'report',
    accessToken: 'exxxxxxxxxxxxxA',
    id: 'c94a6db4-e077-4dde-861a-7c7d22116451',
    embedUrl: 'https://app.powerbi.com/reportEmbed'	 
}; 

var $reportContainer = $('#reportContainer');
 
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);

 var reportPages; 
  

report.on('dataSelected', function(event)
{
var data = event.detail;
		 
         console.log(JSON.stringify(data, null, ' '));
		 
});

report.on('loaded', function(event)
{

report.getFilters().then(function(filters)
    {
         
		
		console.log(filters[0]);
		 
    });
	
    
});
 

}
</script>

<div  id="reportContainer"></div>
</html>

Capture.PNG

View solution in original post

2 REPLIES 2
Eric_Zhang
Microsoft Employee
Microsoft Employee

@mikihiir

 

Based on my test, we can only get the filter objects as in this wiki, NOT all values.

 

<html>

  <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/jquery/dist/jquery.js"></script>

<script src="https://microsoft.github.io/PowerBI-JavaScript/demo/node_modules/powerbi-client/dist/powerbi.js"></script>
     

<script type="text/javascript">
window.onload = function () {
 
var embedConfiguration = {
    type: 'report',
    accessToken: 'exxxxxxxxxxxxxA',
    id: 'c94a6db4-e077-4dde-861a-7c7d22116451',
    embedUrl: 'https://app.powerbi.com/reportEmbed'	 
}; 

var $reportContainer = $('#reportContainer');
 
var report = powerbi.embed($reportContainer.get(0), embedConfiguration);

 var reportPages; 
  

report.on('dataSelected', function(event)
{
var data = event.detail;
		 
         console.log(JSON.stringify(data, null, ' '));
		 
});

report.on('loaded', function(event)
{

report.getFilters().then(function(filters)
    {
         
		
		console.log(filters[0]);
		 
    });
	
    
});
 

}
</script>

<div  id="reportContainer"></div>
</html>

Capture.PNG

Ok, thanks

 

Will make a feature request, need all values for my filter controls(filter dropdowns etc.)

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.