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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Vatz8
Frequent Visitor

Create 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

please try this 

 

Output Date =
IF( 
    DAY(Data[Given Date])<=15, 
    DATE(YEAE(Data[Given Date]), MONTH(Data[Given Date]),15),
    EOMONTH(Data[Given Date],0)
)

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

Supposing your table named Data, try to add a new column with the code below:

Output Date =

IF( 

    DAY(Data[Given Date])<=15, 

    DATE(YEAE(Data[Given Date]), MONTH(Data[Given Date]),15),

    ENDOFMONTH(Data[Given Date])

)

Hi by using this formula I get all the dates with 15. But the endofmonth returns the same date as in the given column.

please try this 

 

Output Date =
IF( 
    DAY(Data[Given Date])<=15, 
    DATE(YEAE(Data[Given Date]), MONTH(Data[Given Date]),15),
    EOMONTH(Data[Given Date],0)
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors