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
Hello Team
Need support on how to use IF and Vlookup functions together in power query or power BI. Example I have two data set like below.
I need to first look for column A, if column is not blank, vlookup the value in second Data Set 2, retun the Division , else (if A column is blank) lookup the value in colum B ( ie PC column) , return the Division from Data Set 2 ( colum B )
DataSet 1
CC | PC | Amt |
CC5900 | 10 | |
PC6902 | 45 | |
CC5901 | 60 | |
Data Set 2 ( Master)
CC/PC | Division |
CC5900 | Sales |
CC5901 | Marketing |
PC6901 | Sales |
PC6902 | Marketing |
Output
CC | PC | Amt | Division |
CC5900 | 10 | Sales | |
PC6902 | 45 | Marketing | |
CC5901 | 60 | Sales | |
Solved! Go to Solution.
hi @BijuDev ,
you can also consider using power query to do this. Here are the steps:
1. go to your Data Set 1 and make sure you have nulls in both column CC / PC
you can use replace values to null them
2. add new column in your dataset 1 using double question marks (coalesce operator)
you will get this column :
3. merge your dataset 1 with dataset 2
4. expand your table and select division column
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: www.linkedin.com/in/lukasz-kozdron
Thanks Luca, I created a calculated column on Data Set 1 using above method. However, I need one more column in Data Set 1 which should retun corresponding Divison Name from Data set 2 ( look up array)
You have to connect the two table and create the measure to do the calculation.
hi @BijuDev ,
you can also consider using power query to do this. Here are the steps:
1. go to your Data Set 1 and make sure you have nulls in both column CC / PC
you can use replace values to null them
2. add new column in your dataset 1 using double question marks (coalesce operator)
you will get this column :
3. merge your dataset 1 with dataset 2
4. expand your table and select division column
I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!
My LinkedIn: www.linkedin.com/in/lukasz-kozdron
Hi,
try to craete the same CC/PC Column also in the dataset 1.
Add calculated column:
CCPC =
IF(ISBLANK(CC), PC, CC)
Then you can connect the dataset1 with dataset2 on CC/PC Column and do the calculation with the measure that you want.
Mark as a solution my answer if i help you.
Thank you.
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 |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |