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

Using IF with two different ResultIfFalse responses

Hey there. Newbie here. I have a column named Stock that contains a variety of values. I've created a new column that I would like to return a No or Yes value based on the below. 

 

What am I doing wrong? 🙂 

 

Stock Y/N = IF('Table'[Stock] = "No", "No", "Yes" OR "Some" OR "Not Many")
 
Stated differently, I'd like a "Yes" return on any value that is not "No" and not empty.
1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try creating calculated columns like this:

Stock Y/N = IF('Table (2)'[Stock]<>"No"&&NOT(ISBLANK('Table (2)'[Stock])),"Yes","No")

test_Stock.PNG

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Is this problem sloved?
If not, please let me know.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous ,

 

check this out.

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

 

Stock Y/N = 
SWITCH(
      'Table'[Stock],
	  BLANK(), BLANK(),
	  "No"   , "No"   ,
	  "Yes"
      )

 

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try creating calculated columns like this:

Stock Y/N = IF('Table (2)'[Stock]<>"No"&&NOT(ISBLANK('Table (2)'[Stock])),"Yes","No")

test_Stock.PNG

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , In a new column this should have worked

Stock Y/N = IF('Table'[Stock] = "No", "No", "Yes")

Means when value is no then return No else return yes

Or

Stock Y/N = IF('Table'[Stock] in{ "Yes" , "Some" , "Not Many"} , "Yes","NO")

Or

Stock Y/N = IF('Table'[Stock] = "Yes" || 'Table'[Stock] = "Some" || 'Table'[Stock] = "Not Many"} , "Yes","NO")

 

For And you can use &&

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.