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
BeckyH1324
Frequent Visitor

Power BI Formula Similar to Excel's =IF Statement

I am trying to figure out how to create a column that looks at a date (column "Due date" - see below) and returns a value of "True" if it's past today's date or "False" if it's not. What is the correct way to do this? I'm able to do it in Excel using +IF statement, but can't figure out how to replicate that in Power BI. I am currently using an app that is pulling data from Planner and dumping it into an Excel file. I cannot update the Excel source file the data is being pulled from since it is being overwritten every hour. Any help is greatly appreciated. Thanks!

DueDate.jpg

 

1 ACCEPTED SOLUTION

Hi again,
There are several options how to achieve it. Maybe not the best, but definitelly very easy is to:
1. Create a new custom column "Today"
2. Function for custom column should look like this:

Migasuke_1-1625086131847.png

 

3. Change the data type from Date-Time to only Date
4. Follow the same logic as I  mentioned before, only now you will use for the comparison this dynamic column instead of a date:

Migasuke_2-1625086131710.png

 

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

View solution in original post

5 REPLIES 5
Migasuke
Super User
Super User

Hi,

you can also create a conditional column with IF. The easiest way is:
1. Go to Add a new column.
2. Add conditional column.
3. Choose which columns to use for evaluation and what should be the condition and results.

Similar in following picture:

Migasuke_1-1625084435892.png

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

All of that worked fine up until I went to save the conditional column. It's forcing me to pick a DateTime value.

DateError.jpg

 I went back, changed the "Today" column to have the full date and time, then created the Conditional Column and it worked. I was able to change the "Today" column after the condition was set to be date only. 

Thank you so much for your help!

 

Interesting behavior, it did not "force" me to have there Date-time value.

Anyway glad to help and please mark this as a solution so others might find it, when they need it.



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

Hi Migasuke,

Thank you for your quick reply. I tried this and it does work as long as designed. I would like the date value to be a dynamic value (ie - whatever today's date may be at any given time). Is it possible to have a formula or something similar in that field so it knows to use today's date rather than just June 30, 2021?

DateValue.jpg

 

Hi again,
There are several options how to achieve it. Maybe not the best, but definitelly very easy is to:
1. Create a new custom column "Today"
2. Function for custom column should look like this:

Migasuke_1-1625086131847.png

 

3. Change the data type from Date-Time to only Date
4. Follow the same logic as I  mentioned before, only now you will use for the comparison this dynamic column instead of a date:

Migasuke_2-1625086131710.png

 

 



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

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.