0
votes

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

enter image description here

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?

3

3 Answers

1
votes

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.

0
votes

The best way to do this is in the Query editor. Press: Edit Queries.

enter image description here

Now select the table and column you want to change the values for and press: Replace Values.

enter image description here

You get a popup, first field null, second 0.

0
votes

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"