+ Reply to Thread
Results 1 to 6 of 6

Conditionally Merge using PowerQuery

  1. #1
    Registered User
    Join Date
    02-07-2014
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    52

    Exclamation Conditionally Merge using PowerQuery

    Hi All

    In the below, I currently have one dimension and one fact table. I have temporarily used the RELATED formula in PowerPivot to join the comments (along with some logic so it only appears once) but the problem of (blank) comes up which I want to hide.

    Instead of using PowerPivot, I was thinking of merging the two tables through PowerQuery so I can use [space] to hide the blanks. My issue is how to only merge the tables when index column = min column. Otherwise, leave it blank so it won't repeat itself when I do the PivotTable.

    Thanks!!


    Data.PNG

    PQ.PNG
    Attached Files Attached Files
    Last edited by swong1709; 08-05-2021 at 10:39 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,970

    Re: Conditionally Merge using PowerQuery

    You can add a conditional column to add Y where those two columns match and then filter out anything that doesn’t contain Y. There are probably more efficient approaches, however I’m away from my PC at the moment.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    02-07-2014
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    52

    Re: Conditionally Merge using PowerQuery

    Quote Originally Posted by AliGW View Post
    You can add a conditional column to add Y where those two columns match and then filter out anything that doesn’t contain Y. There are probably more efficient approaches, however I’m away from my PC at the moment.
    Thanks, may have misunderstood you here. If I added a "Y" where those 2 columns match and then filter out after merging; wouldn't I lose the other rows of data for each country?

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,970

    Re: Conditionally Merge using PowerQuery

    Yes, I think I misread slightly. However, you should be able to do it with a merge, I’d have thought. I’ll have a look when I’m back at my PC if nobody chips in.

  5. #5
    Registered User
    Join Date
    02-07-2014
    Location
    Hong Kong
    MS-Off Ver
    Office 365
    Posts
    52

    Re: Conditionally Merge using PowerQuery

    Thanks for looking into this. I have solved it now.
    I have added a helper column where it shows value if index = min; if not leave it as null. Afterwards, I then remove the original column

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Conditionally Merge using PowerQuery

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 15
    Last Post: 07-31-2020, 10:10 AM
  2. merge cells conditionally
    By Nouman_B in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2020, 12:57 PM
  3. PowerQuery: Merge Expression Errror 'count' argument -- Help Please!!
    By learning new things in forum Excel General
    Replies: 1
    Last Post: 10-01-2019, 03:50 AM
  4. Replies: 1
    Last Post: 01-04-2017, 06:00 PM
  5. Replies: 1
    Last Post: 01-04-2017, 05:59 PM
  6. Conditionally merge rows to columns
    By Pasch in forum Excel General
    Replies: 2
    Last Post: 09-12-2014, 10:02 AM
  7. Replies: 0
    Last Post: 07-09-2009, 05:29 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1