When I tried to add a custom column power BI indicated an error (Token Eof expected) so I changed the null values using the function "replace values". What was the problem, I think that I displayed the right type.
Any suggestions? Thanks.
Solved! Go to Solution.
Well @Greg_Deckler i'm very curious, i tried and this it's happened. (I think):
- When the source is a CSV file and the field is empty the query show it as "empty string" for this reason the value "" is true and the preview appear it as blank. (like your test)
- But, when the source is other (XLS, XLSX, ACCDB, etc) and the field is empty, the query show it as "null value", aaaaannnnd the value "" is false. Reason for this value on the preview appear it as null (like my test)
I didn't change the regional settings, and i'm very very curious
Hi, i recommend you to use lowercase for the sentence "if", PowerQuery is very sensible with this. And i think you have write the complete sentence: if ..... then..... else......
Here are some good walk-throughs on if statements in "M":
I wouldn't think the null would cause you problems, but perhaps. Perhaps use "Null", no quotes. Or, you could fix it in DAX using ISBLANK function.
This "worked" for me:
if [Status] = null then "123" else "321"
Of couse, make sure that you really have a null in those fields that shows up as "null" in italics and without quotes. If it is just blank, then you need to use "" instead of null.
Hi @Greg_Deckler i think both ways seems correct, but the language "M" don't recognizes the value "" and it's necessary to write the value null without quotes.
I tried 🙂
PS: DAX it's different as you say, but i think what the course ask us work on "M"
@Fabiola_K, I did try the "" before posting, it is recognized and works. Honestly, I was a little surprised as well.
BTW, you need the "" instead of the null when your values in preview show up as just blank versus the null in italics.
@Fabiola_K - This is the CSV file I used to import, was testings something else out and just happened to use this as an input. I'm guessing at this point that it is something to do with the language pack? Bizarre.
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Visit our Community Blog for articles, guides, and information created by fellow community members.
Be a part of the leading Microsoft Business Applications digital event, curated for the APAC community.