PowerPivot calculated column: dynamically refer to a column

cr731

Well-known Member
Joined
Sep 17, 2010
Messages
611
In a PowerPivot calculated column, is it possible to dynamically refer to another column? For instance, I have a table with 10 columns for hierarchy levels. I want to write a formula that lets me dynamically refer to one of these columns, sort of like using INDIRECT in Excel. Is this possible? I tried something like,

Code:
SWITCH( value, 
  1, Values([Column1]),
  2, ([Column2]),
  3, ([Column3]), 
etc.

But that doesn't work. Just wondering if this is possible at all or if I give up.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Isn't this the syntax:

SWITCH(expression, value, result[, value, result]…[, else])

?
 
Last edited:
Upvote 0
Dynamically when? Calculated columns are computed at data refresh time, not during runtime(so to speak). If a column is what you want, you can do like noted above:

Code:
SWITCH( TRUE(), Table[Column1] = "Result 1", Table[Column2], Table[Column1] = "Result 2", Table[Column3],Table[Column1] = "Result 3", Table[Column4], Table[Column5] )
 
Upvote 0

Forum statistics

Threads
1,216,216
Messages
6,129,566
Members
449,517
Latest member
Lsmich

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top