Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Urgent issue : DYnamic switching of columns

Hi there,


I am badly stuck with this issue and any help / suggestion would be really appreciated.


I have following 2 tables in my power BI:

Table_A = This is a simple 1 column 2 rows table. The first row value is "View by A" and second row value is "View by B.  I have a slicer based on this table so that I can chose between the view.

Table_B = This table has 2 numeric columns -  COL_A and COL_B.


I also have following formula/measure in the report

IsViewByASelected = IF(SELECTEDVALUE('Table_A'[ColName]) = 'View by A',1,0)


So basically it returns 1 if view by A is selected otherwise 0. 


What I want to achive is simple (well thats what I thought) - I have a clustered column chart. If the View by A is selected then I want to plot the chart using COL_A otherwise COL_B. To achive this I used another formual column:


ColToUse = IF(IsViewByASelected = 1,'Table_B'[COL_A],'Table_B'[COL_B])


However to my surprise regardless of the value of IsViewByASelected only COLB is returned and this dynamic switching between columns does not work.


Am I missing some basic thing ?




Community Support
Community Support

Re: Urgent issue : DYnamic switching of columns

HI @shaileng,


AFAIK, power bi not support dynamic calculate column/table based on slicer.

Calculated Column/Table Change Dynamically According to Slicer Selection in the Report.


So. I think you can't use calculate column to achieve your requirement.


Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors