Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hello! I need to use measure that returns the column name from one take using selectedvalue, and use this columnname to get the column. Example:
Here is my first table:
| id | attribute |
| 1 | Purchase |
| 1 | Emotion |
| 1 | Likability |
| 2 | Purchase |
| 2 | Likability |
| 2 | Emotion |
I will use attribute column as a filter, those 3 attributes are the column names of my second table:
| id | Purchase | Likability | Emotion | ||
| 1 | 0.342 | 0.835 | 0.756 | ||
| 2 | 0.432 | 0.657 | 0.235 | ||
| 3 | 0.754 | 0.654 | 0.765 |
I need to create a formula, to calculated the average of one specific column based on attribute column from the first table:
so I now use:
var filter_attribute = selectedvalue('1 table'[attribute])
var mean = calculate(average( '2 table'[*filter_attribute*] ))
What do I need to put filter_attribute(column name) to DAX will consider it as the column named like this? Thanks in advance!
Solved! Go to Solution.
@Anonymous I would highly recommend that you unpivot those three columns in your 2nd table and then this problem becomes trivial. Alternatively you would have to do this:
var filter_attribute = selectedvalue('1 table'[attribute])
var mean =
SWITCH(__filter_attribute,
"Purchase",calculate(average( '2 table'[Purchase] )),
"Likeability",calculate(average( '2 table'[Likeability] )),
"Emotion",calculate(average( '2 table'[Emotion] )),
)
@Anonymous I would highly recommend that you unpivot those three columns in your 2nd table and then this problem becomes trivial. Alternatively you would have to do this:
var filter_attribute = selectedvalue('1 table'[attribute])
var mean =
SWITCH(__filter_attribute,
"Purchase",calculate(average( '2 table'[Purchase] )),
"Likeability",calculate(average( '2 table'[Likeability] )),
"Emotion",calculate(average( '2 table'[Emotion] )),
)
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 11 | |
| 9 | |
| 8 | |
| 6 | |
| 6 |