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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Calculating a day in the month

Hi 

 

This script currently creates a TargetDate based on the EOMONTH function. I need to change this to return the 20th day of the month. Any suggestions?

 

many thanks

 

J

 

ProactiveMaintenanceTargetDate =

VAR PMDate =
IF(
msdyn_workorders[_Perf_MaintCategory] = "Proactive Maintenance",
MINX(
FILTER(
bookableresourcebookings,
bookableresourcebookings[_msdyn_workorder_value]=EARLIER(msdyn_workorders[msdyn_workorderid])
),
bookableresourcebookings[starttime]
),
BLANK()
)

VAR DateCheck =
//Checks to see whether the date is in a DLS period.
COUNTROWS(
FILTER(
DLS,
DLS[Day Light Savings Start]>=PMDate && DLS[Day Light Savings End]<=PMDate
)
)

VAR NewDate =

IF(
DateCheck>0,
PMDate +(12/24),
PMDate +(13/24)
)



VAR TargetDate =
DATE(
YEAR(NewDate),
MONTH(NewDate),
DAY(NewDate)
)
RETURN
EOMONTH(TargetDate,0)

 

1 REPLY 1
sturlaws
Resident Rockstar
Resident Rockstar

Hi,

 

you can change this part of your code

VAR TargetDate =
    DATE ( YEAR ( NewDate ), MONTH ( NewDate ), DAY ( NewDate ) )
RETURN
    EOMONTH ( TargetDate, 0 )

to this

VAR TargetDate =
    DATE ( YEAR ( NewDate ), MONTH ( NewDate ), 20 )
RETURN
    TargetDate

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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