Variables - Column Name

Hi, I am starting to use variables in my Dax measures but I am struggling to reference a dynamic column name as a variable, so i have referenced the entity which will change as i will be using this measure to work out for several entities, but i need to then add a column name to my table UK which is my effort below of ColName but for whatever reason the computer says no, can anyone help? Thanks

Accrued Income UK =
Var Entity = UK
Var ColName = CONCATENATE(Entity,[G/L Account No.])
Var EntityValues = [Values (CCY)-UK]
Var GL1 = 4000
Var GL2 = 4100

Return
CALCULATE(EntityValues,
FILTER(Entity, ColName = GL1 ||
ColName = GL2))

Hi @BCS,

Try to Unpivot your data so the there is one column with Entities and one column with Values. Once that is in place you can use a CALCULATE and FILTER expression to switch between Entities.

https://forum.enterprisedna.co/t/unpivoting-your-tables/3373

I hope this is helpful.

I recommend adding a demo model so this can be seen more clearly.

Sam

Thanks for posting your question @BCS. To receive a resolution in a timely manner please make sure that you provide all the necessary details on this thread.

Here is a potential list of additional information to include in this thread; demo pbix file, images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

Including all of the above will likely enable a quick solution to your question.