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

Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more

Reply
rs101
New Member

Create custom colum value based on detes between a range in two seperate date columns

Power BI date.PNG I am wanting to create a column with with year of value of '2023' in it if e_start date <= 31st July 2023 and if the e_end is between the dates of >= 1st August 2022 and <= to the 31st July 2023. Can anyone help

1 ACCEPTED SOLUTION
ovde
Resolver II
Resolver II

Something like this should work.

Table.AddColumn(#name of previous step, "Year", each if [e_start] <= #date(2023, 7 ,31) and [e_end] >= #date(2023, 8, 1) and [e_end] <= #date(2023, 7, 31) then 2023 else null)

View solution in original post

2 REPLIES 2
ovde
Resolver II
Resolver II

Something like this should work.

Table.AddColumn(#name of previous step, "Year", each if [e_start] <= #date(2023, 7 ,31) and [e_end] >= #date(2023, 8, 1) and [e_end] <= #date(2023, 7, 31) then 2023 else null)

Thanks that gave me enough information to help me solve the issue!

Helpful resources

Announcements
PBIApril_Carousel

Power BI Monthly Update - April 2025

Check out the April 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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