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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
DMB90
Helper II
Helper II

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
Anonymous
Not applicable

Thanks for the reply from @nandic , allow me to provide additional information on your comments based on the user's data. 
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:

vlinyulumsft_0-1715925297563.png

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

vlinyulumsft_1-1715925327283.png

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.

vlinyulumsft_2-1715925362508.png

4.Here are some related documents to help you:

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.

View solution in original post

3 REPLIES 3
nandic
Resident Rockstar
Resident Rockstar

@DMB90 

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
        )
    )

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.

DMB90_0-1715304008752.png

 

Anonymous
Not applicable

Thanks for the reply from @nandic , allow me to provide additional information on your comments based on the user's data. 
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:

vlinyulumsft_0-1715925297563.png

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

vlinyulumsft_1-1715925327283.png

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.

vlinyulumsft_2-1715925362508.png

4.Here are some related documents to help you:

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.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.