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

Excel Power Query IF Statement

Hi,

 

I am trying to work on a formula, but it isnt working out.

The column Approved Date has data with Dates and some without Dates (blank)

I would like to put in a formula mentioning , if its blank then the column should return Not Approved

 

if [Approval Date] = null then "Not Approved" else "Approved"

Annotation 2020-09-08 111502.png

 

 

 

 

1 ACCEPTED SOLUTION

Hello @Anonymous 

 

there is definitly a null in your column if the cell is empty. So I checked it against "null" and it works perfectly fine

image.png

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

11 REPLIES 11
Anonymous
Not applicable

Hi @amitchandak and @Jimmy801 

 

Tried both the methods, the below is the screenshot, I checked the cell, it has only date and the type is selected as date.

 

Capture2.PNG

Hello @Anonymous 

 

last two tries 🙂

if Text.Clean(Text.Trim([Approval Date])) = "" then "Not Approved" else "Approved"

 

if Value.Is([Approval Date],type datetime) = true then "Approved" else "Not approved"

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

@Jimmy801 Tried it not working

 

Anyway to send by email and give it a try

 

Capture3.PNG

Hello @Anonymous 

 

could you upload the file to some sharing site and share the link here, then I can check it

 

Jimmy

Anonymous
Not applicable

Hi @Jimmy801 

 

The file in the below link. I have given the column names with the ones we discussed here.

 

https://drive.google.com/file/d/1wydE7mu23l2VHmvXyIBn5MyWQoW7Thhu/view?usp=sharing

Hello @Anonymous 

 

there is definitly a null in your column if the cell is empty. So I checked it against "null" and it works perfectly fine

image.png

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

Anonymous
Not applicable

I just changed the "" and changed it to null and its working

Jimmy801
Community Champion
Community Champion

Hello @Anonymous 

 

the formula is perfectly fine. However I think your values are not containing null but "" instead

Try to change your formula to:

if [Approval Date] = "" then "Not Approved" else "Approved"

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

@Anonymous ,

 

Try like

if Text.Trim([Approval Date]) = "" then "Not Approved" else "Approved"

 

You can add or [Approval Date] = null

Anonymous
Not applicable

Hi @Jimmy801 , I tried that too even it then returned only Approved

Below picture :

 

Annotation 2020-09-08 114907-2.png

Hello @Anonymous 

 

check your cell content then. I don't know your database, but it could also be that your empty cell contains a space. Try this solution then

if [Approval Date] = " " then "Not Approved" else "Approved"

 

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

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.

Top Solution Authors
Top Kudoed Authors