Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

column condition if else

Hello 

Column will always three values , " Y", "N","Null" .

I did sample calculated column in dax  if colum1 = 'Y', 'N', but how do i look for "null" value also if  two values (y&N) not found.

 

Thanks 

Refint

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @Anonymous 

it depends on what exactly null do you have.

if you have "null" as text compare it with null in quotas:

IF([Column1] = "Null", 1, 0)

if you have null as blank field try ISBLANK()

IF(ISBLANK([Column1]), 1, 0)

or BLANK()

IF([Column1] = BLANK(), 1, 0)

so, your full statement if you have both nulls in data:

SWITCH(TRUE(),
[Column1] = "Y", "Y value",
[Column1] = "N", "N value",
[Column1] = "Null", "Null as text value",
[Column1] = BLANK(), "Null as blank value",
"any other value"
)

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

4 REPLIES 4
az38
Community Champion
Community Champion

Hi @Anonymous 

it depends on what exactly null do you have.

if you have "null" as text compare it with null in quotas:

IF([Column1] = "Null", 1, 0)

if you have null as blank field try ISBLANK()

IF(ISBLANK([Column1]), 1, 0)

or BLANK()

IF([Column1] = BLANK(), 1, 0)

so, your full statement if you have both nulls in data:

SWITCH(TRUE(),
[Column1] = "Y", "Y value",
[Column1] = "N", "N value",
[Column1] = "Null", "Null as text value",
[Column1] = BLANK(), "Null as blank value",
"any other value"
)

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
harshnathani
Community Champion
Community Champion

Hi @Anonymous ,

 

Incase you want to understand nulls, blank, isblank and empties in DAX

 

https://www.youtube.com/watch?v=C26DQkb4hyY

 

Incase you want to understand this is Power Query

 

https://www.youtube.com/watch?v=EoRjNx1G2g4

 

Regards,
Harsh Nathani

Appreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!

pranit828
Community Champion
Community Champion

Hi @Anonymous 

 

To find the null value 

 

ISBLANK('table'[column])     //Returns a Boolean value of TRUE if the value is blank; otherwise FALSE.

 

Did I resolve your issue? Mark my post as a solution!

 

Appreciate your Kudos, Press the thumbs up button!!

 

Regards,
Pranit





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
DataZoe
Employee
Employee

@Anonymous null values can usually be found by looking for blank() in DAX. For what you are doing, maybe a switch statement would work? 

 

 

CalcColSwitch = SWITCH('Table'[Column],"Y","Yes","N","No","N/A")

 

https://docs.microsoft.com/en-us/dax/switch-function-dax

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.