Results 1 to 1 of 1

Thread: PQ - Power Query: search multiple columns against a list of values?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sir Moderator sandy666's Avatar
    Join Date
    May 2018
    Posts
    239
    Rep Power
    7

    Cool PQ - Power Query: search multiple columns against a list of values?

    (question from the web)
    I am trying to move an excel SUMPRODUCT function into Power Query.
    The function searches a column against a list of names in a table, then returns TRUE if one is found.
    Code sample:
    IF ( SUMPRODUCT ( ISNUMBER ( SEARCH ( Table[Column], [@[current_field]] ) ) * ROW ( $rows included in Table[Column] ) ) >0, TRUE, FALSE )

    There are seven (7) columns to check for each record so I put all of the separate SUMPRODUCT functions within an OR ( ) clause.
    IF ( OR ( SUMPRODUCT ( ISNUMBER ( SEARCH ( Table[Column], [@[first_field]] ) ) * ROW ( $rows included in Table[Column] ) ) >0,
    SUMPRODUCT ( ISNUMBER ( SEARCH ( Table[Column], [@[second_field]] ) ) * ROW ( $rows included in Table[Column] ) ) >0,
    ...
    SUMPRODUCT ( ISNUMBER ( SEARCH ( Table[Column], [@[seventh_field]] ) ) * ROW ( $rows included in Table[Column] ) ) >0), TRUE, FALSE )

    Does Power Query have an analogous function or functionality to accomplish this task?

    Background: The report collects data in Excel then links to Access for table joins and processing.
    I need to see if I can move this very manual report out of Access and completely into Excel.
    1. forget about worksheet functions
    2. change your mindset using Power Query
    3. source tables and expected result table are very welcome
    so...
    here is supposed example of the result
    Names Column1 Column2 Column3 Column4 Column5 Column6 Column7
    abc
    TRUE
    FALSE
    FALSE
    FALSE
    TRUE
    TRUE
    FALSE
    def
    FALSE
    TRUE
    FALSE
    FALSE
    FALSE
    FALSE
    TRUE
    ghi
    FALSE
    FALSE
    TRUE
    FALSE
    FALSE
    TRUE
    FALSE


    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    https://eileenslounge.com/viewtopic.php?p=317218#p317218
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316955#p316955
    https://eileenslounge.com/viewtopic.php?p=316940#p316940
    https://eileenslounge.com/viewtopic.php?p=316927#p316927
    https://eileenslounge.com/viewtopic.php?p=317014#p317014
    https://eileenslounge.com/viewtopic.php?p=317006#p317006
    https://eileenslounge.com/viewtopic.php?p=316935#p316935
    https://eileenslounge.com/viewtopic.php?p=316875#p316875
    https://eileenslounge.com/viewtopic.php?p=316254#p316254
    https://eileenslounge.com/viewtopic.php?p=316280#p316280
    https://eileenslounge.com/viewtopic.php?p=315915#p315915
    https://eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315744#p315744
    https://www.eileenslounge.com/viewtopic.php?p=315512#p315512
    https://eileenslounge.com/viewtopic.php?p=315680#p315680
    https://eileenslounge.com/viewtopic.php?p=315743#p315743
    https://www.eileenslounge.com/viewtopic.php?p=315326#p315326
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40752
    https://eileenslounge.com/viewtopic.php?p=314950#p314950
    https://www.eileenslounge.com/viewtopic.php?p=314940#p314940
    https://www.eileenslounge.com/viewtopic.php?p=314926#p314926
    https://www.eileenslounge.com/viewtopic.php?p=314920#p314920
    https://www.eileenslounge.com/viewtopic.php?f=30&t=40533&p=314837#p314837
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 05-20-2024 at 03:47 PM.
    sandy
    I know you know but I forgot my Crystal Ball and don't know what you know also I may not remember what I did weeks, months or years ago so answer asap. Thinking doesn't hurt

Similar Threads

  1. PQ - Transforming Text to Date in Power Query
    By sandy666 in forum Power Query, Power Pivot and Power BI
    Replies: 2
    Last Post: 02-22-2021, 01:08 AM
  2. PQ - How to get Total via Power Query
    By sandy666 in forum ETL PQ Tips and Tricks
    Replies: 0
    Last Post: 09-23-2020, 06:10 PM
  3. PQ - UnZip an use Content in Power Query
    By sandy666 in forum ETL PQ Tips and Tricks
    Replies: 0
    Last Post: 05-13-2020, 05:37 AM
  4. Replies: 7
    Last Post: 05-15-2013, 02:56 PM
  5. Search and remove values ​​from a list
    By PcMax in forum Excel Help
    Replies: 4
    Last Post: 04-14-2013, 08:39 PM

Posting Permissions

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