cancel
Showing results for 
Search instead for 
Did you mean: 
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

 

 

View solution in original post

5 REPLIES 5
Migasuke
Solution Supplier
Solution Supplier

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

 

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.

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

 

 

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors
Top Kudoed Authors