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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shaileng
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 ?

 

 

 

1 REPLY 1
v-shex-msft
Community Support
Community Support

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.

 

Regards,
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

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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