• 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

Power Query - Insert new data rows depending on condition|Power Query|Excel Forum|My Online Training Hub

You are here: Home / Power Query - Insert new data rows depending on condition|Power Query|Excel Forum|My Online Training Hub
Avatar
sp_LogInOut Log In sp_Registration Register
sp_Search Search
Advanced Search|Last Search Results
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 QueryPower Query - Insert new data rows …
sp_PrintTopic sp_TopicIcon
Power Query - Insert new data rows depending on condition
Avatar
Lucian C

New Member
Members
Level 0
Forum Posts: 2
Member Since:
May 23, 2022
sp_UserOfflineSmall Offline
1
May 23, 2022 - 6:17 pm
sp_Permalink sp_Print sp_EditHistory

Hello,

I need some help with the following issue.

I have a data table like this:

Company Account Amount Partner
C1 100 1000 P1
C1 100 2000 P2
C1 200 1000 P1
C1 100 3000 P1
C2 400 1000 P3
C2 400 2000 P4

I need to add some new data rows into this table based on the following "mapping table":

Company Account Partner Destination Account
C1 100 P1 300
C2 400 P3 500

Basically, when in the data table there is a "match" on the Company+Account+Partner from the mapping table, and this could be considered a primary key in the "mapping table" and a foreign key in the "data table", a new "pair" record should be added for same amount, but switching Company with the Partner for the new account.

The resulting table should be like this:

Company Account Amount Partner
C1 100 1000 P1
P1 300 1000 C1
C1 100 2000 P2
C1 200 1000 P1
C1 100 3000 P1
P1 300 3000 C1
C2 400 1000 P3
P3 500 1000 C2
C2 400 2000 P4

Is it possible to achieve this in PQ?

Kind Regards,

Lucian

Avatar
Lucian C

New Member
Members
Level 0
Forum Posts: 2
Member Since:
May 23, 2022
sp_UserOfflineSmall Offline
2
May 23, 2022 - 8:52 pm
sp_Permalink sp_Print

Hello,

Meanwhile I have find out myself how to solve it: Merge the tables, expanded the required columns then do a "self append".

So no need to approve this post, but just in case it will, I have attached the "solved file" in the case I will need it again - when I forgot about it and I will search for the problem again Wink

Kind Regards,

Lucian

The following users say thank you to Lucian C for this useful post:

Mynda Treacy
sp_Feed
Go to top
Forum Timezone: Australia/Brisbane
Most Users Ever Online: 245
Currently Online: Cassie Bernier
Guest(s) 10
Currently Browsing this Page:
1 Guest(s)
Top Posters:
SunnyKow: 1432
Anders Sehlstedt: 873
Purfleet: 414
Frans Visser: 346
David_Ng: 306
lea cohen: 222
Jessica Stewart: 215
A.Maurizio: 202
Aye Mu: 201
jaryszek: 183
Newest Members:
Abisola Ogundele
MARTYN STERRY
Rahim Lakhani
Ngoc Qui Nguyen
Clement Mansfield
Rose .
Bindu Menon
Baruch Zemer
Purple RainbowBenefactor
MOTH Junkie
Forum Stats:
Groups: 3
Forums: 24
Topics: 6350
Posts: 27773

 

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

Sidebar

Blog Categories

  • Excel
  • Excel Charts
  • Excel Dashboard
  • Excel Formulas
  • 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
 

Company

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

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.