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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Column reference as variable

Hey guys,

 

I would like to replace a static value (in that case a column reference) by an variable:

daniel_st_0-1648644631740.png

I tried it the following way which didn't work:

 

"RemovedColumns[#"""& HierachyAttribute &"""]"


Would appreciate any hints 🙂

Thanks Dan

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

You can try following (this will depend upon your context)

Table.Column(RemovedColumns,HierachyAttribute)

 

Example is below

    RemovedColumns = Table.RemoveColumns(#"Changed Type",{"Country"}),
    HierachyAttribute = "Sales Channel",
    #"Added Custom" = Table.AddColumn(RemovedColumns, "Custom", each Table.Column(RemovedColumns,HierachyAttribute))

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

works like a charm! Thanks @Vijay_A_Verma 

Vijay_A_Verma
Super User
Super User

You can try following (this will depend upon your context)

Table.Column(RemovedColumns,HierachyAttribute)

 

Example is below

    RemovedColumns = Table.RemoveColumns(#"Changed Type",{"Country"}),
    HierachyAttribute = "Sales Channel",
    #"Added Custom" = Table.AddColumn(RemovedColumns, "Custom", each Table.Column(RemovedColumns,HierachyAttribute))

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors