+ Reply to Thread
Results 1 to 10 of 10

Delete null cells in Power query

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Delete null cells in Power query

    Hello

    in appended query, looking to delete null cells ( don't delete entire rows) in query and shift cells up
    Attached Files Attached Files
    Last edited by alansidman; 06-15-2022 at 09:44 AM.

  2. #2
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Delete null cells in Power query

    Please try

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Grouped = Table.Group(Source, {"DATA"}, {{"T", each Table.ToList(_)}}),
        Combine = Table.FromColumns(Grouped[T],Grouped[DATA])
    in
        Combine
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Delete null cells in Power query

    Thanks working but I am looking for steps after I append the tables, don't start from beginning and use main table
    because the data will be different not same, u will separate it by column name
    looking for custom situation

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,024

    Re: Delete null cells in Power query

    try this

    let
        Source = Table.Combine({A, B, C}),
        #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {}, "Attribute", "Value"),
        #"Grouped Rows" = Table.Group(#"Unpivoted Columns", {"Attribute"}, {{"Data", each _, type table [Attribute=text, Value=text]}}),
        #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each Table.AddIndexColumn([Data],"Index",1,1)),
        #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"Data"}),
        #"Expanded Custom" = Table.ExpandTableColumn(#"Removed Columns", "Custom", {"Value", "Index"}, {"Custom.Value", "Custom.Index"}),
        #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Expanded Custom", {{"Custom.Index", type text}}, "en-US"), List.Distinct(Table.TransformColumnTypes(#"Expanded Custom", {{"Custom.Index", type text}}, "en-US")[Custom.Index]), "Custom.Index", "Attribute"),
        #"Transposed Table" = Table.Transpose(#"Pivoted Column")
    in
        #"Transposed Table"
    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

  5. #5
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Delete null cells in Power query

    can't post the formula according to forum issues.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,213

    Re: Delete null cells in Power query

    Please try

    let
        Source = Excel.CurrentWorkbook(){[Name="Append1"]}[Content],
        Com = Table.FromColumns(List.Transform(Table.ToColumns(Source),List.RemoveNulls), Table.ColumnNames(Source))
    in
        Com
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,306

    Re: Delete null cells in Power query

    Formullas
    unicate
    Formula: copy to clipboard
    =IFERROR(INDEX($A$1:$A$100,MATCH(TRUE,INDEX((COUNTIF($B1:B1,$A$1:$A$100)=0),0),0)),"")

    value
    Formula: copy to clipboard
    =IFERROR(INDEX($A$1:$A$100,AGGREGATE(15,6,ROW($1:$100)/($A$1:$A$100=C$1),ROWS($2:2))),"")
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Delete null cells in Power query

    Thanks all
    Bo_Ry #6

  9. #9
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    922

    Re: Delete null cells in Power query

    May I know why power query is no read the code if its in upper case?
    COM = TABLE.FROMCOLUMNS(LIST.TRANSFORM(TABLE.TOCOLUMNS(SOURCE),LIST.REMOVENULLS), TABLE.COLUMNNAMES(SOURCE))

  10. #10
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2406 Win 11 Home 64 Bit
    Posts
    24,024

    Re: Delete null cells in Power query

    Power Query is case sensitive. All function keys must be according to the case. To see exact case, in a new query in the function line, type #share

    Also read the following: https://www.sqlbi.com/articles/lette...ula%20language.

+ 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. Query Editor to take value above if its Null
    By jp16 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-06-2022, 07:28 AM
  2. [SOLVED] Query that includes NULL values
    By dunnobe in forum Access Tables & Databases
    Replies: 4
    Last Post: 04-26-2018, 10:54 AM
  3. SQL: How do I replace NULL ( empty ) with zero in a sql query. For instance:
    By kbdb in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2018, 03:31 PM
  4. Replies: 4
    Last Post: 05-11-2013, 10:47 PM
  5. Macro Needed to delete range of cells based on null values in another cell
    By jeffmarsiglio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2013, 08:22 AM
  6. [SOLVED] How can Access form run a query if field is not null?
    By jgomez in forum Access Tables & Databases
    Replies: 10
    Last Post: 01-14-2013, 02:35 PM
  7. How to delete rows that include blank/null cells
    By kostas in forum Excel General
    Replies: 5
    Last Post: 04-27-2007, 07:47 AM

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