cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
UserInterface Regular Visitor
Regular Visitor

Show if field is blank or not.

Hi I have just installed Power BI for a test and am stuck straight away.

I have a field that I wish to report if it is empty or not. (Something like 20% Missing, %80 Found)

 

I initially thought that I could just apply a filter on a Pi chart but couldn't work that out, so tried to add a new column the same way I would in excel but that fails too. Can anyone put me on the right path?

 

I tried the following 

IF([ATTRIBUTE_2401],"","Missing","Found")

But get the error Expression.Error: The name 'IF' Wasn't recognized. 

 

I also tried with ISBLANK BLANK and a few others.

1 ACCEPTED SOLUTION

Accepted Solutions
SivaMani Senior Member
Senior Member

Re: Show if field is blank or not.

Can you try this?

 

IF([ATTRIBUTE_2401] = "","Missing","Found")

11 REPLIES 11
Super User
Super User

Re: Show if field is blank or not.

I'm assuming you are created a new column using DAX.  If so you need to name the column.  It should look something like this:

 

 

FoundTag = IF(
 isBlank([ATTRIBUTE_2401]),
 "Missing",
 "Found"
)

 

 


   

              Did I answer your question? Mark my post as a solution!
       

Proud to be a Datanaut!


   


SivaMani Senior Member
Senior Member

Re: Show if field is blank or not.

Can you try this?

 

IF([ATTRIBUTE_2401] = "","Missing","Found")

UserInterface Regular Visitor
Regular Visitor

Re: Show if field is blank or not.

I tried this one first and it works, i guess i was just missing the = sign.. i don't rememebr using that before but it had been a long time.

 

Thanks!

SivaMani Senior Member
Senior Member

Re: Show if field is blank or not.

Great!

 

Please mark it as a solution and hit kudo button if it is helpful.

 

Thanks,

Siva

UserInterface Regular Visitor
Regular Visitor

Re: Show if field is blank or not.

Actually I spoke to soon.

When I try the same soultion on another field (different table) that contains the same data it doen't find the blanks, although it is reporting the others.

 

I tried both 

Status = IF(isBlank([UDF_CHAR1]),"Missing","Found")

and

Status = IF([UDF_CHAR1] = "","Missing","Found")

I don't get any errors, its just is not showing the blanks.

 

The only difernece between the fields is one is nvarchar(3500) and other is nvarchar(250) otherwise the have been poulated with the same script.

 

Screenshot where you can see the orginal working one, and the new one looking at the new field.

https://imgur.com/gxo0Vv8

Super User
Super User

Re: Show if field is blank or not.

Check what the actual contents of the table are.  In data terms, null, "", and " " are all considered different.  Something as a simple as an extra space could be the cause for an issue.


   

              Did I answer your question? Mark my post as a solution!
       

Proud to be a Datanaut!


   


UserInterface Regular Visitor
Regular Visitor

Re: Show if field is blank or not.

If i look in SMS then it just says NULL, but i tried that too.

After i made that last post i found that i can see that actual data in powerBI, so took a look at that field and found that it is not displaying any of the blank rows, however, I can see them in the DB

 

udf_char1 is the new field.

 

DAX2.png

 

Super User
Super User

Re: Show if field is blank or not.

Did you import the column with a different name?  Looking at your SQL, should your code be:

 

Status = IF(isBlank([Imported MEF Expiry Date]),"Missing","Found")

What other data manipulation is occuring in your import that concerns this field?  Try getting a dump of the table, as it sits in Power BI, into Excel and look at the contents.


   

              Did I answer your question? Mark my post as a solution!
       

Proud to be a Datanaut!


   


UserInterface Regular Visitor
Regular Visitor

Re: Show if field is blank or not.

When i look at the data in PowerBI then this field doesn't show any null values, even though it does for the other rowsdax3.PNG..