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
carlam
New Member

Evaluate a string as a column name

Hi, 

I'm new to Power BI and I'm having some troubles trying to evaluate a string as a column name.

 

I have a table like

BIG TABLE

Field1, Field2, ..., Field30

0.3, 0.4, ..., 0.2

0.5, 0.2, ..., 0.88

...

 

and a listbox like

FIELDS

FIELD_X

Field1,

Field2, 

...,

Field30

 

I get what I select on the listbox as Selected_X = SELECTEDVALUE(FIELDS[FIELD_X]). So, if I select "Field13" on FIELD_X I get Selected_X ="Field13". 

Now I want a columnX to become dynamically equal to 'BIG TABLE'[Field13].

 

I tried column_X="'BIG TABLE'[" & Selected_X & "]" but it didn't work.

 

How can I get this?

 

Thanks, 

 

Carla

 

3 REPLIES 3
SteveCampbell
Memorable Member
Memorable Member

Hello,

 

Is there a key to this table? I'm assumin you will need another filter to see what row you are reffering too? 

 

One way is you can unpivot your table.
Go to advanced editor. If you have a key, select that column, If not add an index in Add Coulmn > Index Column. Select this new column.

 

Click Transform tab. On the "Unpivot Columns" dropdown, Click "Unpivot Other Columns". It will now give you Attribute and Value column. Attribute is your column name (FIELD X), which you can use in your slicer.

 

 

 



Did I answer your question? Mark my post as a solution! Proud to be a Super User!


Connect with me!
Stay up to date on  
Read my blogs on  



carlam
New Member

Hi, 

I'm new to Power BI and I'm having some troubles trying to evaluate a string as a column name.

 

I have a big table like

BIG TABLE

Field1, Field2, ..., Field30

0.3, 0.4, ..., 0.2

0.5, 0.2, ..., 0.88

...

and a slider like

FIELDS

FIELD_X

Field1,

Field2, 

...,

Field30

 

I get what I select on the slider as Selected_X = SELECTEDVALUE(FIELDS[FIELD_X]). So, if I select "Field13" on FIELD_X I get Selected_X ="Field13". 

 

Now I want a columnX to become dynamically equal to 'BIG TABLE'[Field13].

 

I tried column_X="'BIG TABLE'[" & Selected_X & "]" but it didn't work.

 

How can I get this?

 

Thanks, 

 

Carla

 

Did you ever obtain your solution? I am having same issue. It would be great help if you could post how u approach to get a solution. 

 

Thanks, 

K

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.