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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors