• Skip to main content
  • Skip to header right navigation
  • Skip to site footer

My Online Training Hub

Learn Dashboards, Excel, Power BI, Power Query, Power Pivot

  • Courses
  • Pricing
    • Free Courses
    • Power BI Course
    • Excel Power Query Course
    • Power Pivot and DAX Course
    • Excel Dashboard Course
    • Excel PivotTable Course – Quick Start
    • Advanced Excel Formulas Course
    • Excel Expert Advanced Excel Training
    • Excel Tables Course
    • Excel, Word, Outlook
    • Financial Modelling Course
    • Excel PivotTable Course
    • Excel for Customer Service Professionals
    • Excel for Operations Management Course
    • Excel for Decision Making Under Uncertainty Course
    • Excel for Finance Course
    • Excel Analysis ToolPak Course
    • Multi-User Pricing
  • Resources
    • Free Downloads
    • Excel Functions Explained
    • Excel Formulas
    • Excel Add-ins
    • IF Function
      • Excel IF Statement Explained
      • Excel IF AND OR Functions
      • IF Formula Builder
    • Time & Dates in Excel
      • Excel Date & Time
      • Calculating Time in Excel
      • Excel Time Calculation Tricks
      • Excel Date and Time Formatting
    • Excel Keyboard Shortcuts
    • Excel Custom Number Format Guide
    • Pivot Tables Guide
    • VLOOKUP Guide
    • ALT Codes
    • Excel VBA & Macros
    • Excel User Forms
    • VBA String Functions
  • Members
    • Login
  • Blog
  • Excel Webinars
  • Excel Forum
    • Register as Forum Member
  • Login

create a VLOOKUP in power query with with two conditions|Power Query|Excel Forum|My Online Training Hub

You are here: Home / create a VLOOKUP in power query with with two conditions|Power Query|Excel Forum|My Online Training Hub

office scripts course

Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search
Search
Forum Scope




Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Search Search
sp_RankInfo
Lost password?
sp_CrumbsHome HomeExcel ForumPower Querycreate a VLOOKUP in power query wit…
sp_PrintTopic sp_TopicIcon
create a VLOOKUP in power query with with two conditions
Avatar
thenewbee thenewbee
Member
Members
Level 0
Forum Posts: 21
Member Since:
January 12, 2021
sp_UserOfflineSmall Offline
1
March 1, 2023 - 12:52 am
sp_Permalink sp_Print sp_EditHistory

Hello all,

I´m looking for a solution, to use something similar like VLOOKUP in a power query with two conditions.

 

We have a list of items/products, that is produced in one country.

These products are now sold in multiple different countries from the production country.

Screenshot-2023-02-28-152836-2.pngImage Enlarger

Now I would like to check if the countries are maintained correctly. We see on the first item, that´s available in 4 countries, but the source is inactive. "China" is inactive as well, so we need to maintain "Germany" and "France".

The second item is everywhere "active", so no action needed.

On the third item we see the source active, but "Germany" is inactive, so it needs corrected.

 

So I tried a VLOOKUP (in German "Sverweis") to figure out the correct combination. As there are multiple items and multiple enties about the production location, I had to do a combination of both. Also that combination does not look really nice in the table. And in addition I would prefere to have it Power Query.

Screenshot-2023-02-28-153205-2.pngImage Enlarger

Has somebody an idea, where I can start from? 🙂Smile

sp_PlupAttachments Attachments
  • sp_PlupImage Screenshot-2023-02-28-152836-2.png (27 KB)
  • sp_PlupImage Screenshot-2023-02-28-153205-2.png (122 KB)
sp_AnswersTopicSeeAnswer See Answer
Avatar
Alan Sidman
Steamboat Springs, CO
Member
Members


Trusted Members
Level 0
Forum Posts: 173
Member Since:
October 18, 2018
sp_UserOfflineSmall Offline
2
March 1, 2023 - 4:30 am
sp_Permalink sp_Print

I am a bit confused as to what you want the end result to look like.  Please mock up a solution so we have a better idea.

Avatar
thenewbee thenewbee
Member
Members
Level 0
Forum Posts: 21
Member Since:
January 12, 2021
sp_UserOfflineSmall Offline
3
March 2, 2023 - 2:28 am
sp_Permalink sp_Print

Hello Alan,rnwell, I have a list, with muliple items, and these items are sold in multiple countries.rn(coulum F & coulmn I)rnAll of these items are sourced from one country (source of thruth) (column H)rn rnNow we have in that source of truth an item status, like active, or inactive and all othere items have to follow this.rn rnI would now like to see, which item has in all countries the same status as in the source of truth.rnrn rnSo in this example, the item A100 is procuded in USA. That region is inactive, so all other countries need to be on inactive as well.rnChina is already inactive, thats good, no action required. Germany and France are active, and habe to turn to inactive.rn 

Avatar
Lionel Baijot
Member
Members
Level 0
Forum Posts: 119
Member Since:
September 9, 2020
sp_UserOfflineSmall Offline
4
March 2, 2023 - 3:46 pm
sp_Permalink sp_Print

Hi thenewbee,

From what I understand, this is what I propose.

1. You load your data in PwQ (t_source).
2. You duplicate this array and name it t_transfo. This will be the final result.
3. With t_source, you filter by 'produced in' and 'sold in' to get only 'USA'. You will have the unique status.
4. With t_transfo, you merge this table with the t_source table, keeping only the status column.

I did all this in the 'Source&Transfo' sheet.

 

BR, 

Lionel

sp_AnswersTopicAnswer
Answers Post
Avatar
thenewbee thenewbee
Member
Members
Level 0
Forum Posts: 21
Member Since:
January 12, 2021
sp_UserOfflineSmall Offline
5
March 2, 2023 - 10:50 pm
sp_Permalink sp_Print sp_EditHistory

Hi all,

I´m sorry, that my previous post has no structure. There went something wrong by submitting them. 🙁

 

@ Lionel,

many thanks for this, it has a good starting point 🙂

In this case the results are correct.

The challange is, that you filtered only 'sold in' to get only 'USA'. You did this, as your understanding from column 'produced in' was always USA. I´m looking for that link.

If we change the production location for item "A100" in Germany and France, to Germany, they should follow that status.

So "A100" is produces in Europe in Germany. As Germany is active, France should be active as well.

For China and USA the production location will USA. As USA is now inactive, China should inactive as well.

 

Screenshot-2023-03-02-135227.pngImage Enlarger

sp_PlupAttachments Attachments
  • sp_PlupImage Screenshot-2023-03-02-135227.png (28 KB)
Avatar
Lionel Baijot
Member
Members
Level 0
Forum Posts: 119
Member Since:
September 9, 2020
sp_UserOfflineSmall Offline
6
March 3, 2023 - 12:24 am
sp_Permalink sp_Print

Hi thenewbee,

Here is the correction according to my understanding. 😉

BR,

Lionel

Avatar
thenewbee thenewbee
Member
Members
Level 0
Forum Posts: 21
Member Since:
January 12, 2021
sp_UserOfflineSmall Offline
7
March 7, 2023 - 12:22 am
sp_Permalink sp_Print sp_EditHistory

Bonjour Lionel,

many thanks for this, that´s looks great 🙂

sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Cindy Walawander
Guest(s) 11
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 880
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 237
Jessica Stewart: 219
A.Maurizio: 213
Aye Mu: 201
jaryszek: 183
Newest Members:
Clare Webber
David Jenssen
Dominic Brosnahan
Young You
Jennifer Owens
Mohamed Touahria
Sheila McCall
Nicholas Montano
John Babcock
QSolutions Group
Forum Stats:
Groups: 3
Forums: 24
Topics: 6524
Posts: 28549

 

Member Stats:
Guest Posters: 49
Members: 32803
Moderators: 2
Admins: 4
Administrators: Mynda Treacy, Philip Treacy, Catalin Bombea, FT
Moderators: Velouria, Riny van Eekelen
© Simple:Press —sp_Information

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • Excel Office Scripts
  • Excel PivotTables
  • Excel Shortcuts
  • Excel VBA
  • General Tips
  • Online Training
  • Outlook
  • Power Apps
  • Power Automate
  • Power BI
  • Power Pivot
  • Power Query
microsoft mvp logo
trustpilot excellent rating
Secured by Sucuri Badge
MyOnlineTrainingHub on YouTube Mynda Treacy on Linked In Mynda Treacy on Instagram Mynda Treacy on Twitter Mynda Treacy on Pinterest MyOnlineTrainingHub on Facebook

Sign up to our newsletter and join over 400,000
others who learn Excel and Power BI with us.

 

Company

  • About My Online Training Hub
  • Disclosure Statement
  • Frequently Asked Questions
  • Guarantee
  • Privacy Policy
  • Terms & Conditions
  • Testimonials
  • Become an Affiliate
  • Sponsor Our Newsletter

Support

  • Contact
  • Forum
  • Helpdesk - For Technical Issues

Copyright © 2023 · My Online Training Hub · All Rights Reserved. Microsoft and the Microsoft Office logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Product names, logos, brands, and other trademarks featured or referred to within this website are the property of their respective trademark holders.