0

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 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

3 Comments

i have to try this already. but it's not work cuz I don't have row that's have "Null" values
So if your value is "Blank", you can put that in the first field. It can also be "", an empty string. Concept stays same, you need the replace function.
Hi Albert. Sorry for follow up question, but is there a way to force PBI to import properly empty cells (with "") as Blanks? I have like 40 numeric columns in excel with some cells empty. I must import them as blanks (not zeros, it is important to distinguish valid zeros and blanks).
0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.