Hi all
I do a lot of validation, for instance checking if 2 columns are equal, and if not I list the differences in a conditional column. So lets say I have a table like below
nullcheck0.png
If Column1 and Column2 are not equal, I want to show content of Column1, Column2 and Column3 in a new Check column. I do that with this code for the Check column:
= Table.AddColumn(#"Replaced Value", "Check", each if [Column1] <> [Column2] then [Column1] & [Column2] & [Column3] else null)
So this would be my expected result in that column:
nullcheck1.png
Problem is that if one of the columns I want to show content from contains a null, then it does not show anything as it all evaluates to null, see first row :
nullcheck2.png
How can I get the differences listed regardless of whether some of the columns contains a null?
Bonus question: It seems PQ is not very consistant about nulls and blanks, when it comes to functions like merge etc. Some functions seems to be default null, while others are default blanks. This is also the case with different column types, like number and text. I was not aware of this, when I started using PQ, which means I now have a lot of different data, where some columns contains null, while others contain blanks. I realize that in some cases you do need to differ null from blank, but what are the general best practice about this - is it something like always replacing null with blank (or vice versa) after doing your steps, so data becomes consistant or is there another way of handling this?
Best regards
Imbizile
Bookmarks