Forum Discussion
jhayes0128
2 years agoFrequent Visitor
Access Field Parameter values in DAX
I have a field parameter referencing 3 different columns. The values inside of those columns are the same. I want to write a measure that says "if GPDCN do something special". Using SELECTEDVALUE or SUMMARIZE on the parameter table just returns the name of the column (like LE_PROXY) but I need the values of that column inside of a measure. How to do this?
Field Parameter:
The values inside of each column:
1 Reply
- AmiraBedhSuper User
With DAX, it's not straightforward to dynamically switch between different columns based on a parameter and then also evaluate the values within those columns.
But here is a workaround :SpecialMeasure = VAR SelectedField = SELECTEDVALUE('ParameterTable'[FieldName], "Default") VAR Result = SWITCH( TRUE(), SelectedField = "Budget", CALCULATE(SUM('Fact_Impacts'[BUDGET_PROXY]), 'Fact_Impacts'[BUDGET_PROXY] = "GPDCN"), SelectedField = "LE", CALCULATE(SUM('Fact_Impacts'[LE_PROXY]), 'Fact_Impacts'[LE_PROXY] = "GPDCN"), SelectedField = "YoY", CALCULATE(SUM('Fact_Impacts'[PY_PROXY]), 'Fact_Impacts'[PY_PROXY] = "GPDCN"), BLANK() ) RETURN Result