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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
NCPowerBI
Helper I
Helper I

If statement greater than certain date in a column

Hi all,

 

I am using an If statement in a newly created column to reference a certain column if it's greater than 4/30/2023 and another column when it is less than this date. The two columns it's referencing I created to get the data I need for each. For some reason, the field is not working correctly and it's only referencing the Normal Extension Amt (Update) field for all months. Do you see anything wrong with the below formula where it wouldn't be referencing the date correctly? FYI, the DATA_AS_OF_DT field is a short date field and I checked the formatting several times.

 

NCPowerBI_0-1686322618754.png

 

3 REPLIES 3
Syk
Super User
Super User

Create the column in the power query editor and it will give you a UI to make this a bit easier. In PQ editor go to Add Columm > Conditional Column. Fill out the if statement and change your output value to a column (highlighted below). Hope this helps!

 

 

Syk_1-1686323142930.png

 

 

@Syk  I just tried that but the columns it allows me to reference in the output options are only from the source data, not the columns I created from different fields from the source data so it won't work.

The columns you're trying to reference are calculated columns? I'd suggest recreating them in M (power query) so you can reference them in future expressions and performance will likely improve for your report as well.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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