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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Change column field in matrix/table using slicer

Hi, I have a table visual which shows Sales by Region i.e. North, East. 

Sales by RegionSales by Region

What I want to achieve is, that when I select any region from slicer (I have a dropdown slicer of region), the same table show sales data by State of that selected region. (States in place of region in the same table).

2.PNG

I have tried few ways, like tried to create a measure, which can switch column dynamically (switch case, when region = 'east', then state column). Read this article : https://www.nathanprats.com/4-different-ways-to-dynamically-change-tables-rows-in-power-bi/ but this use case seems different. There are many tutorials which show how to dynamically add column which is not the use case here.

 

What I tried, is that I first checked if any region is selected, if yes then checked if any state is selected:

switch to this in table
= IF(ISBLANK([sel_region]),"R",IF(ISBLANK([sel_state]),"S","C")).
So in this way I am able to return, and find out what is selected.
3.PNG
 
 And, then on the basis of this value when I tried to switch column, this is where I get stuck.
Measure 7 = SWITCH(
    true(),
    [switch to this in table]="R",VALUES(Orders[Region]),
    [switch to this in table]="S",VALUES(Orders[State/Province]),
    [switch to this in table]="C",VALUES(Orders[City])
)
 
Is there a way through which I can simply call/use column from my table directly without the use of values or anything else. Simply, replacing switching column name. See below that how and where I am thinking to change column dynamically
4.PNG
If any region is selected, then instead of "Region", here I am trying to pull "State" column. Once the state column will be placed here, it will automatically obey the filter context of region slicer and will show only states from that region.

 

Any help is much appreciated!

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Based on what I got, Please check if field parameters can help

 

Power BI Field Parameters — A Quick way for Dynamic Visuals: https://amitchandak.medium.com/power-bi-field-parameters-a-quick-way-for-dynamic-visuals-fc4095ae9afd
Power BI Field Parameters- Measure Slicer and Axis/Dimension slicer: https://youtu.be/lqF3Wa1FllE
Switch TOPN with Field Parameters: https://amitchandak.medium.com/switch-topn-with-field-parameters-299a0ae3725f
Field Parameters- Conditional Formatting
: https://amitchandak.medium.com/field-parameters-conditional-formatting-517aacc23fdf

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak great! field parameters has solved the problem of changing axis dynamically. But, if I select State in parameter, then it show states of all region

5.PNG

Then, to view state of a particular region, I have to select Region from dropdown slicer. So, it has become a 2 click process. Filtering is happening with slicer, axis is changing with parameter. Is there a way to combine both of these functionalities into 1 slicer, to achieve my actual requirement of doing both filtering and changing of axis as we select region from dropdown slicer.

 

And, parameter slicer is not effecting rest of the dashboard, as I see in model view, parameter table is not connected with any table.

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.