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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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