Reputation: 1
I connect to Data from Stored Procedure not directly a table from Database so I'm not sure that's why I cannot use Script like
RiskCount = IF( ISBLANK( [My column] ), 0, [My column])
It's a warning cannot find name [My column]
My data from the database looks like
When data showed up that's made company 1 value c = "Blank"
I want to replace it with "0"
I'm not sure if Power BI can do something like this or if I should edit from the database?
Upvotes: 0
Views: 14551
Reputation: 692
In the Power Query Editor(Advanced Editor)
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{.........................
#"Replaced Value" = Table.ReplaceValue(#"Changed Type",null,each _[Desired column for replacement],Replacer.ReplaceValue,{"Value"}),
in
#"Replaced Value"
Upvotes: 0
Reputation: 40264
The blanks in the column are likely an empty string ""
rather than a null.
Try doing replacing values like @Aldert described, but leave the first box empty with 0 in the second box so you get M code like this:
= Table.ReplaceValue(Source,"",0,Replacer.ReplaceValue,{"Value"})
Notice the ""
instead of null
.
Upvotes: 1
Reputation: 4323
The best way to do this is in the Query editor. Press: Edit Queries.
Now select the table and column you want to change the values for and press: Replace Values.
You get a popup, first field null, second 0.
Upvotes: 0