Forum Discussion
Transform Values taken from a Lookup Table
- 8 years ago
HI WALEED
Yes in that case Power Query is the choice
See the attached file here fro Power Query solution
Do you want a calculated column, NEW TABLE, MEASURE?
For example you can add following Calculated Column in Source Table
Revised Field 1 =
LOOKUPVALUE (
LookUpTable[NEW VALUE],
LookUpTable[OLD VALUE], SourceTable[FIELD 1],
LookUpTable[FIELD NAME], "FIELD 1"
)
In case you want the Old Value when there is no corresponding NEW value, you can use this
Revised Field 1 =
VAR myvalue =
LOOKUPVALUE (
LookUpTable[NEW VALUE],
LookUpTable[OLD VALUE], SourceTable[FIELD 1],
LookUpTable[FIELD NAME], "FIELD 1"
)
RETURN
IF ( ISBLANK ( myvalue ), SourceTable[FIELD 1], myvalue )- WALEED8 years agoAdvocate II
Many thanks; please allow me to pick your brain a little more:
I'm using Power BI. will this work in Power Query?
Is there a way to identify the field name using the first column of the lookup table?
And finally, replace the original column with the transformed one.
The reason I want it to be dynamic is there are 243 ever-changing fields.
- Zubair_Muhammad8 years agoCommunity Champion
HI WALEED
Yes in that case Power Query is the choice
See the attached file here fro Power Query solution
- Zubair_Muhammad8 years agoCommunity Champion
Here are the steps for Power Query Solution
Step #1: select Field Columns in Source Table and unpivot them
Step 2: Perform a Merge Query using 2 fields each from Source Table and LookUp Table