Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
OKgo
Advocate II
Advocate II

Replace all values in column using a another table to store transformations/translations

Translation Table (All rows are unique). 
The numbers assigned do not have a strong logic. A look up would be required.

Location New_Location

World02 World
Argentina07 Argentina


Data (Many duplicates)

Location Value

World5
World6
Mexico18


I would like to replace the Data[Location] with Translation[New_Location]. If there is no entry in the translation table the orignal entry is acceptable. Within the model a many to one relationship between Data[Location] and Translation[Location] exisits. There is too many values to make replace values feature practical and the translation table is subject to changes.

In Excel, I would have created a VLOOKUP helper column. Then copy and paste-special-values to overwrite the orignal location Data[Location] entries. I am strugling through these fourms and google to find an elgant solution. Thank you very much in advance for your time!
 

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

Hi @OKgo

 

Try this calculated column in DataTable

 

New Location =
VAR RESULT =
    CALCULATE ( FIRSTNONBLANK ( TranslationTable[New_Location], 1 ) )
RETURN
    IF ( ISBLANK ( RESULT ), 'DataTable'[Location], result )

Regards
Zubair

Please try my custom visuals

View solution in original post

5 REPLIES 5
Zubair_Muhammad
Community Champion
Community Champion

Hi @OKgo

 

Try this calculated column in DataTable

 

New Location =
VAR RESULT =
    CALCULATE ( FIRSTNONBLANK ( TranslationTable[New_Location], 1 ) )
RETURN
    IF ( ISBLANK ( RESULT ), 'DataTable'[Location], result )

Regards
Zubair

Please try my custom visuals

@OKgo

 

Onetomanylookup.png


Regards
Zubair

Please try my custom visuals

Hi Zubair_Muhammad. Thank you so much for replying. Am I using the correct window to use the code? The show error feature highlights the word RESULT.

PBI.png

Yes this is wrong window.

The formula is for a calculated column

Right click the table, select new column and then use this formula


Regards
Zubair

Please try my custom visuals

Thank you so much! It works in the report view.

 

I was hoping to be able to see the column within edit queries to check the output but maybe that is not possible.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.