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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Dynamically change table headers according to javascript API parameter

Hi all,

I need help to change the table headers or columns according to the parameter I input during embedding the power bi on my application with javascript API. So I have this filter on my frontend application

 

 

var  IamAFilter = {
  $schema: "http://powerbi.com/product/schema#basic",
  target: {
    table: "sample_table",
    column: "id"
  },
  operator: "In",
  values: [1]
}

 

 

and let's say this is my sample_table or my data

 

idcolumn1column2column3column4column5column6
1sample_datasample_datasample_datasample_datasample_datasample_data
2sample_datasample_datasample_datasample_datasample_datasample_data
3sample_datasample_datasample_datasample_datasample_datasample_data
4sample_datasample_datasample_datasample_datasample_datasample_data

 

and

I want to display on my table in power bi if ever my parameter is 1:

table graph in power BI:

column1column2column6
sample_datasample_datasample_data
sample_datasample_datasample_data
sample_datasample_datasample_data
sample_datasample_datasample_data

 

I want to display on my table in power bi if ever my parameter is 2:

table graph in power BI:

column2column5
sample_datasample_data
sample_datasample_data
sample_datasample_data
sample_datasample_data

 

these are just examples of the output. Basically I want the columns to change according to the parameter that I passed from my frontend application. Help please I am still new to power BI

1 ACCEPTED SOLUTION

Hi @Anonymous, as you've seen in the video (min 06:40), you can add extra columns to field parameters table to aggreate values. 

This approach could be useful If you'd assign a column to only one parameter at a time:

Sergii24_0-1718613284376.png

Considering that you have "Column2" that should appear for both "Parameter1" and "Parameter2" I'd rather use bookmarks (detail on bookmark)

Good luck and remember to accept an answer as solution if you belive it is useful 🙂

View solution in original post

3 REPLIES 3
Sergii24
Super User
Super User

Hi @Anonymous, I'm not sure that such functionality is present in PoweBI. I'd suggest you to load all columns to your data model (well, actually the minimum number of required columns 😉 ) and then use a feature called "Field Parameter" to dynamically show part of columns.

You can learn more about Field Parameters here - Fields parameters in Power BI

I hope it helps!

Anonymous
Not applicable

Thank you @Sergii24  the link you sent is helpful.

I have another question if you don't mind. I think if I can pre-assign the slicer values to ids so that the end-users won't have to select them anymore then that would solve my problem.

  • Is there a way to do that?
  • Should I create another table for that?

Hi @Anonymous, as you've seen in the video (min 06:40), you can add extra columns to field parameters table to aggreate values. 

This approach could be useful If you'd assign a column to only one parameter at a time:

Sergii24_0-1718613284376.png

Considering that you have "Column2" that should appear for both "Parameter1" and "Parameter2" I'd rather use bookmarks (detail on bookmark)

Good luck and remember to accept an answer as solution if you belive it is useful 🙂

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.