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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Vatz8
Helper I
Helper I

Add custom date column based on another date.

Hi,

I want to create a custom date column with displays 15th of every month and the end of the month based on a date column.

Any day less than or equal to 15th should display 15th and any day less than or equal to the End of the month should display end of month.

For example-->

Given Date           Output Date

10/9/2022             10/15/2022

10/11/2022           10/15/2022

10/17/2022           10/31/2022

10/20/2022           10/31/2022

11/7/2022             11/15/2022

11/17/2022           11/30/2022

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

You can add a custom column with this logic:

if Date.Day([Given Date]) <= 15
then Date.AddDays([Given Date], 15-Date.Day([Given Date]))
else Date.EndOfMonth([Given Date])

AlexisOlson_0-1668467336804.png

View solution in original post

2 REPLIES 2
ppm1
Solution Sage
Solution Sage

You can use this formula in a custom column in the query editor to get your result.

 

= if Date.Day([Given Date]) <= 15 then #date(Date.Year([Given Date]), Date.Month([Given Date]), 15) else Date.EndOfMonth([Given Date])

 

Pat

Microsoft Employee
AlexisOlson
Super User
Super User

You can add a custom column with this logic:

if Date.Day([Given Date]) <= 15
then Date.AddDays([Given Date], 15-Date.Day([Given Date]))
else Date.EndOfMonth([Given Date])

AlexisOlson_0-1668467336804.png

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.