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

Join us at FabCon Vienna from September 15-18, 2025, for the ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM. Get registered

Reply
amien
Helper V
Helper V

How to easily use a VLOOKUP/ApplyMAP not using a JOIN

In Qlik you have this function called ApplyMap:

 

MapTableName:
Mapping LOAD
      ValueIn

      ValueOut
Resident Dates

You can now use this is Table in a regular load script like this:

 

FactTable:

ApplyMap('MapTableName',DateF,Null()) as Week

 

How can i easlily do this in Spark without using a join

 

I was thinking about first loading a dataframe with the ValuesIn,ValuesOut

Then load the FactTable into a second dataframe.

 

How how do i add the new column with the "VLOOKUP"? i don't want to use a join

 

 

 

 

 

1 ACCEPTED SOLUTION
spencer_sa
Super User
Super User

Assuming you're refering to doing this in a pySpark Notebook (as opposed to a data pipeline).
A not-necessarily-best-practice* solution if you didn't want to use a join with a broadcasted lookup table would be to use a UDF (user defined function).


Step 1 - create a function that does the mapping, and then wrap it in a user defined function.

Step 2 - use the UDF in a .withColumn statement e.g.   df2 = df.withColumn('column name', UDF('column name'))

* UDFs can have performance implications

View solution in original post

1 REPLY 1
spencer_sa
Super User
Super User

Assuming you're refering to doing this in a pySpark Notebook (as opposed to a data pipeline).
A not-necessarily-best-practice* solution if you didn't want to use a join with a broadcasted lookup table would be to use a UDF (user defined function).


Step 1 - create a function that does the mapping, and then wrap it in a user defined function.

Step 2 - use the UDF in a .withColumn statement e.g.   df2 = df.withColumn('column name', UDF('column name'))

* UDFs can have performance implications

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June FBC25 Carousel

Fabric Monthly Update - June 2025

Check out the June 2025 Fabric update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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