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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

SELECTEDVALUES as existing column names

Hi im new to power BI, and i was wondering if i am able to use the SELECTEDVALUE value to call out the column of the table with the same name as the value given? In a way, performing this action : 

CALCULATE(SUM(Graph[User Chosen]), Graph[SnapMonth] = [User Selection])

 

User Chosen = SELECTEDVALUE('Full Snap Months'[SnapMonth])     #Full Snap Months is referencing table 
Graph is the table where all the data and measures are located in.



Screenshot (9).png

Pleaseee help 🙂

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

do you mean you want to use [User Chosen] as selected column name? if yes, actually  Graph[User Chosen]  this is not supported in desktop.

you can take a workaround to solve the question. you can try IF() or Switch() like bellow.

Measure = 
var _a= SELECTEDVALUE('filter'[filter])
return IF(_a="Column1", SUM('Table'[Column1]),IF(_a="Column2",SUM('Table'[Column2])))

hope it helps.

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xiaotang
Community Support
Community Support

Hi @Anonymous 

do you mean you want to use [User Chosen] as selected column name? if yes, actually  Graph[User Chosen]  this is not supported in desktop.

you can take a workaround to solve the question. you can try IF() or Switch() like bellow.

Measure = 
var _a= SELECTEDVALUE('filter'[filter])
return IF(_a="Column1", SUM('Table'[Column1]),IF(_a="Column2",SUM('Table'[Column2])))

hope it helps.

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Understood! So there really isnt any way to automate this measure in desktop?

Hi @Anonymous 

yes, that's really impossible. in Dax expression, the format is fixed, 'Table'[Column].  it can not be dynamic.

 

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , seem like [User Chosen] is a measure , if so

 

 

CALCULATE(SUMX(Graph,[User Chosen]), Graph[SnapMonth] = [User Selection])

 

or

 

CALCULATE(Countx(Graph,[User Chosen]), Graph[SnapMonth] = [User Selection])

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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