+ Reply to Thread
Results 1 to 11 of 11

Power query zero versus null in calculaton

  1. #1
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    614

    Power query zero versus null in calculaton

    Hi I have a question regarding the use of null,

    if I have N columns containing numbers and zeros and multiply them I end up with 0 , all good,
    but if I want he 0's ignored I can change these to null values and then,

    Please Login or Register  to view this content.
    but have tried an accumulation;

    Please Login or Register  to view this content.
    in the above each column contains 1 or 0 , and another table values 2,3,4, and this works, but if I change the 0's to nulls
    any row containing a null returns a total of null?
    Why does this happen,

    I have attached the sheet with bot versions, I have a further questing regarding null but will leave that for later.

    Richard
    Attached Files Attached Files

  2. #2
    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,890

    Re: Power query zero versus null in calculaton

    null is not considered a number in PQ and therefore cannot be calculated in any maths. Instead of an error message, it tells you that by returning null that there is something amiss. Try to change the format in a column?field that contains all nulls and you will receive an error. The gods in Redmond designed it that way.
    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

  3. #3
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    614

    Re: Power query zero versus null in calculaton

    You say it cannot be calculated but if I have four columns in excel containing values ; 1 , 2 , blank and 4 ,
    these would be in pq ; 1, 2 , null , 4 which I cant the get the product of

    Please Login or Register  to view this content.
    so in the above it is ignored, and I get 8 1 * 2 * 4.

    So why in my first question why is it not ignored instead of giving a result of null.

    Richard.

  4. #4
    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,890

    Re: Power query zero versus null in calculaton

    Blank and null are not equal.

    See if this link helps you

    https://gorilla.bi/power-query/sum-null-values/
    Last edited by alansidman; 10-24-2023 at 09:13 AM.

  5. #5
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    614

    Re: Power query zero versus null in calculaton

    but if you have an empty cell in excel loaded to pq it is turned to null and then in the multiplication they do not affect the result,
    but in the accumulation they do have an affect on the result in he initial question they do affect the result.

  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,890

    Re: Power query zero versus null in calculaton

    I've exhausted my understanding of the issue. Richard, good luck finding an answer and if you do, please post it here for others to understand.

  7. #7
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    614

    Re: Power query zero versus null in calculaton

    Thanks for all your help, I know I can go on a bit, if I ever get answer I'll post it. shall have to re watch Mike Girvins
    vid on blanks, zero text strings etc.

    Richard.

  8. #8
    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,890

    Re: Power query zero versus null in calculaton

    Richard
    Will you provide Mike's link. I would like to look at it. Always interested in learning new "stuff" in Mcodes and PQ

  9. #9
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    614

    Re: Power query zero versus null in calculaton

    there are these two he may have done some more up date as these are just for excel, I watched these some time ago.

    https://www.youtube.com/watch?v=ubrpg2ffyNc&t=43s

    https://www.youtube.com/watch?v=DOtrWoXSBjA



    Richard.

  10. #10
    Forum Contributor
    Join Date
    08-03-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    614

    Re: Power query zero versus null in calculaton

    just finish, you may find this interesting.

    I loaded a small table contain a space between letters in cells, and also a blank cell,

    when converted to lists ;

    Please Login or Register  to view this content.

    the blank cell becomes a null but the space is blank, when a TEXT.VALUE is run, the blank = text .

    Its easier t see so Ivw attached it.

    Richard.
    Attached Files Attached Files

  11. #11
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Power query zero versus null in calculaton

    If you read the About section for List.Product it specifically says that it "Returns the product of the non-null numbers in the list" (emphasis added). Operators do not ignore nulls.
    Rory

+ 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: 2
    Last Post: 07-14-2023, 08:21 AM
  2. [SOLVED] Power Query - Replacing null values
    By daithy in forum Excel General
    Replies: 20
    Last Post: 01-20-2023, 04:24 AM
  3. [SOLVED] Delete null cells in Power query
    By Undo in forum Excel General
    Replies: 9
    Last Post: 06-19-2022, 02:01 PM
  4. [SOLVED] Need help- Power Query Merge function return null value!
    By marvin-tech in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-14-2022, 12:23 PM
  5. [SOLVED] Replace duplicates with null by power query
    By siddiqsh in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 07-20-2020, 04:38 AM
  6. Power Query Merge Columns if Not Null
    By brent_milne in forum Excel General
    Replies: 1
    Last Post: 01-26-2020, 11:41 AM
  7. How to remove null values from several columns with Power Query?
    By toblju in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2016, 11:08 AM

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