Forum Discussion
PeRoma
2 years agoFrequent Visitor
create column with DAX using paramters as identifier for column
Hi all, I would like to copy a column using DAX. The problem is that the column is selected as a parameter. Example: Nummer AA BB CC 1 123 111 2 222 3 345 ...
Sahir_Maharaj
Super User
2 years agoHello PeRoma,
Can you please try this:
CalculatedTable =
ADDCOLUMNS(
SUMMARIZE(T1, T1[Nummer]),
"SelectedValue", SWITCH(TRUE(),
SelectedColumn = "AA", CALCULATE(SUM(T1[AA])),
SelectedColumn = "BB", CALCULATE(SUM(T1[BB])),
SelectedColumn = "CC", CALCULATE(SUM(T1[CC])),
BLANK()
)
)
PeRoma
2 years agoFrequent Visitor
Hi Sahir,
Thank you for your response.
But sorry, this does not answer my question. My goal to copy the column into table T2. All the values.
If I e.g. select column "AA" from table T1- at run time by any means I want to copy only this column into table T2. The problem is, I don't know how to reference a column dynamically with a parameter, measure or by any other means. This referenced column should then be copied into table T2.
In other words: I have no problem to reference columns within DAX by just naming them. But I want to reference to a column that is only selected at run time. And I want to copy this column.
Thank you for your effort. Do you have any idea based on this explanation?
Best
peroma