cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## If Date from a Column is Between a Specific Date Range, Then Return A Value

Hi, I'm trying to create a DAX for this expression (examples below):

If [DATE] from a column falls between 3/1/24 and 2/28/25, then FY2024, if [DATE] from the same column falls between 3/1/23 and 2/29/24, then FY2023

1 ACCEPTED SOLUTION
Community Support

Hi,@DMB90

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

2. Below are the Calculated Columns I've created for your needs:

date check =
SWITCH(TRUE(),'Table'[1.Cteated Date]>=DATE(2024,3,1)&&'Table'[1.Cteated Date]<=DATE(2025,2,28),"FY2024",
'Table'[1.Cteated Date]>=DATE(2023,3,1)&&'Table'[1.Cteated Date]<=DATE(2024,2,29),"FY2023",
BLANK())

3.Here's my final result, which I hope meets your requirements.

Tutorial: Create your own measures in Power BI Desktop - Power BI | Microsoft Learn

Tutorial: Create calculated columns in Power BI Desktop - Power BI | Microsoft Learn

Also, I've attached my pbix file so you have the option to get it in time if you need it.

Best Regards,

Leroy Lu

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

3 REPLIES 3
Memorable Member
Calculated column:

FiscalYear =
VAR CurrentDate = 'Calendar'[Date]
RETURN
IF(
AND(
CurrentDate >= DATE(2024, 3, 1),
CurrentDate <= DATE(2025, 2, 28)
),
"FY2024",
IF(
AND(
CurrentDate >= DATE(2023, 3, 1),
CurrentDate <= DATE(2024, 2, 29)
),
"FY2023",
BLANK() // Return blank if date does not fall into specified ranges
)
)
Frequent Visitor

This is my date column that I want to check against specified date ranges. I'm not sure how to check my date range against this date column below.

Community Support

Hi,@DMB90

Regarding the issue you raised, my solution is as follows:

1.First I have created the following table and the column names and data are the data you have given:

2. Below are the Calculated Columns I've created for your needs:

date check =
SWITCH(TRUE(),'Table'[1.Cteated Date]>=DATE(2024,3,1)&&'Table'[1.Cteated Date]<=DATE(2025,2,28),"FY2024",
'Table'[1.Cteated Date]>=DATE(2023,3,1)&&'Table'[1.Cteated Date]<=DATE(2024,2,29),"FY2023",
BLANK())

3.Here's my final result, which I hope meets your requirements.

Tutorial: Create your own measures in Power BI Desktop - Power BI | Microsoft Learn

Tutorial: Create calculated columns in Power BI Desktop - Power BI | Microsoft Learn

Also, I've attached my pbix file so you have the option to get it in time if you need it.

Best Regards,

Leroy Lu

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

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors