- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
replace null values with content from another column based on condition
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-16-2019 07:12 PM
I have 20 million rows loaded. I want to replace null values from Column B. The value to be replaced will depends on what value is indicated on the column a.
Example:
For null values,
1 = W
4 = E
and so on..
Please take note that null values are many. And the null values is not limited to two only.
Just new to power bi desktop. please guide me. How should I do this?
Solved! Go to Solution.
Accepted Solutions
Re: replace null values with content from another column based on condition
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-17-2019 11:24 PM - edited 01-17-2019 11:27 PM
Hi @dorothybl,
Did you get any error messages? Or it returns wrong results?
Maybe this one.
Result_Column = IF ( [Column B] = blank(), LOOKUPVALUE ( 'FixTable'[Letter], 'FixTable'[Number], [Column A] ), [Column B] )
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
All Replies
Re: replace null values with content from another column based on condition
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-16-2019 07:16 PM
Hi,
Create a lookup table and then join your existing Table with the look up Table.
Re: replace null values with content from another column based on condition
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-16-2019 07:36 PM
apologies but i cannot figure out how should i make a look up table for this.
i have 20 millions rows.
Re: replace null values with content from another column based on condition
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-16-2019 07:44 PM
Hi,
Since there are multiple null values, you will have to tell the software what should go in place of each such cell. So there will have to be an input table of 2 columns with column 1 values from your existing table. The second column should be the result you want.
Re: replace null values with content from another column based on condition
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-17-2019 09:09 PM
Hi @dorothybl,
Where are all the replacements? In other words, where is "1 = W 4 = E" from? It could be like this one.
Result_Column = IF ( ISBLANK ( [Column B] ), LOOKUPVALUE ( 'replacementsTable'[result], 'replacementsTable'[Column A], [Column A] ), [Column B] )
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Re: replace null values with content from another column based on condition
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-17-2019 10:22 PM - edited 01-17-2019 10:25 PM
it will come from a separate table called "FixTable" and here is the sample data inside it. Data in the "FixTable" are only those numbers with blank letters.
I tried using your code but it did not work. can you check what was wrong with it?
Result_Column = IF ( ISBLANK ( [Column B] ), LOOKUPVALUE ( 'FixTable'[Letter], 'FixTable'[Number], [Column A] ), [Column B] )
Re: replace null values with content from another column based on condition
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-17-2019 11:24 PM - edited 01-17-2019 11:27 PM
Hi @dorothybl,
Did you get any error messages? Or it returns wrong results?
Maybe this one.
Result_Column = IF ( [Column B] = blank(), LOOKUPVALUE ( 'FixTable'[Letter], 'FixTable'[Number], [Column A] ), [Column B] )
Best Regards,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Re: replace null values with content from another column based on condition
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
01-17-2019 11:46 PM
hey it works! thanks @v-jiascu-msft