Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
is it possible to use a variable to select dynamically a column? Example
TABLE A
--------------------
NewColumn =
var name_column = "Column" & (5+1)
return
---> Here I want to return the values of "Column6" (5+1), based on variable "name_column" who has been calculated dynamically <----
Thanks
Solved! Go to Solution.
Hi @Anonymous,
Only way I can think of is to create a switch statement:
new column =
SWITCH (
yourCalculationValue,
1, column1,
2, column2,
.
.
.
.
.
6, column6,
blank )
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Hi @Anonymous,
Only way I can think of is to create a switch statement:
new column =
SWITCH (
yourCalculationValue,
1, column1,
2, column2,
.
.
.
.
.
6, column6,
blank )
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
20 | |
7 | |
6 | |
5 | |
5 |
User | Count |
---|---|
26 | |
10 | |
10 | |
9 | |
6 |