March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi there.
I have a simple task but just can't figure it out.
This is table1
countryCode | countryName |
HK | Hong Kong |
MY | Malaysia |
SG | Singapore |
CN | China |
This is table2
Country/Region Name |
HK |
Malaysia |
SG |
CN |
I want to add a column (final_country) in table2 that looks something like this
Country/Region Name | final_country |
HK | Hong Kong |
Malaysia | Malaysia |
SG | Singapore |
CN | China |
so basically, the "final_country" column value will depend on "Country/Region Name". If its like HK, SG and CN it should refer to table1 and give me the countryName else give me the original value like "Malaysia"
Solved! Go to Solution.
if the rows of table 1 is unique, then try this code:
NewStep=Table.AddColumn(Table2,"Final_Country",each Table1{[CountryCode=[#"Counrty/Region Name"]]}?[CountryName]? ??[#"Counrty/Region Name"])
@wdx223_Daniel it's working now! so sorry , some typo of the column names.
1 question : what does the "?" do in your solution?
use ? to get a null when the result of former statement is a error.
use ?? to get the latter statement result if the former gives a null.
if the rows of table 1 is unique, then try this code:
NewStep=Table.AddColumn(Table2,"Final_Country",each Table1{[CountryCode=[#"Counrty/Region Name"]]}?[CountryName]? ??[#"Counrty/Region Name"])
Yes table 1 is unique
= Table.AddColumn(#"NoRegisterYesAttend","Final_Country",each #"Country Look Up Table"{[CountryCode=[#"Country/Region Name"]]}?[CountryName]? ??[#"Country/Region Name"])
"NoRegisterYesAttend" is my 2nd table name
"Country Look Up Table" is my 1st table name
but it gives me the error - Expression.Error: A cyclic reference was encountered during evaluation.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
16 | |
13 | |
12 | |
9 |
User | Count |
---|---|
36 | |
31 | |
20 | |
19 | |
17 |