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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

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
Most Valuable Professional
Most Valuable Professional

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
Most Valuable Professional
Most Valuable Professional

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
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.