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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Alirezam
Helper V
Helper V

Replacing multiple valuse in Query

Hi mates,

I have 2 tables. I want to replace one column's values with the second table. According to the photo attached, I want to replace 1 with a, 2 with b, 3 with c, so on.

I know I can do it with lookupvalue but I do not know how to use this function in Query editor where we can only relace single value each time.

 

I appreciate that,Capture.PNG

6 REPLIES 6
danextian
Super User
Super User

Hi @Alirezam ,

 

Try this in Power Query:

 

let 
//this will select the value from a list based on position where 1 is position 0
x = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k"}
in  x{[Halfhour]-1}

 

or if the list is from another table

let 
//this will convert the values of the column holding the replacement values to a list. Make sure that the values are in the desired order.
x = AnotherTable[ColumnName] 
in  
//this will select the value from a list based on position where 1 is position 0
x{[Halfhour]-1}

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
v-juanli-msft
Community Support
Community Support

Hi @Alirezam 

If the problem is sloved, could you kindly accept it as a solution so to close the case?

If not, please try the method below:

If your data is simple as your screenshot, create a match table, then merge queries in your main table, finally expand the column to get the "Letter" column.

Capture3.JPGCapture4.JPGCapture5.JPG

If your data is complex, please show me some examples.

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

vivran22
Community Champion
Community Champion

Hello@Alirezam 

 

What is the structure of table 2?

Col 1: Half Hour (with values from 1 to 26) & Col 2: Letters (with values from a to z)?

 

If this is so, then you can use Merge Queries option in Power Query

 

Power Query.JPG

 

Regards,
Vivek

If it helps, please mark it as a solution

Kudos would be a cherry on the top 🙂

https://www.vivran.in/

amitchandak
Super User
Super User

Based on data share I am not sure what columns are common in two table.  But you can always get values from one table to another using x function like

New column in Table 1 = maxx(filter(table2,table1[customer] = table2[customer] && table2[option]="construction",table2[value])

New column in Table 1 = maxx(filter(table2,table1[Attribute] = table2[name] && table1[project] = table2[project]),table2[name])

Condition may vary, minx, countx, sumx can also be used.

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks Amit, I simply want to replace the left yellow comlumn with the second yellow column. They are in 2 different tables.

Hello @Alirezam,

 

Has your problem got resolved?

 

Regards,
Vivek

If it helps, please mark it as a solution

Kudos would be a cherry on the top 🙂

https://www.vivran.in/

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.