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

Help with turning target formula to YTD

Hello, I have a dax formula that works well to figure out the monthly target based on the provider start date, however I can not figure out how to get it to total the year to date number. For example if the target is 100 in Jan, 100 in Feb and 100 in March in the sample data this would be for Shan, when I select all 3 months on the filter I would like it to say 300.

 

Here is the measure:

Monthly Target Hours = var __curdate = TODAY()
var __providerstartdate = MIN('Global Staff Targets'[Provider Start Date])
var __firstdate = MIN(Dates[Date])
var __lastdate = MAX(Dates[Date])
var __daysworked = SELECTEDVALUE('Global Staff Targets'[# of Days Worked Per Week])
var __startdate =
IF(
__providerstartdate<=__firstdate,__firstdate,
__providerstartdate
)
RETURN
DIVIDE(
DATEDIFF(__startdate,__lastdate,DAY),
DATEDIFF(__firstdate,__lastdate,DAY),0
)*(__daysworked/5)*100
 
Here is some a sample data set:
Provider IDProvider Full NameProvider Start Date# of Days Worked Per Week
1Shan SmithNovember 8, 20215
8Lisa SmithFebruary 14, 20225
21Katie SmithMarch 16, 20225
 
Can anyone help me please?
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Not very clear , can you explain with example

 

 

refer, if this can help

https://community.powerbi.com/t5/Community-Blog/How-to-divide-distribute-values-between-start-date-or-end-date/ba-p/1503785

Distributing/Allocating the Monthly Target(Convert to Daily Target): Measure ( Daily/MTD): https://community.powerbi.com/t5/Community-Blog/Power-BI-Distributing-Allocating-the-Monthly-Target-Convert-to/ba-p/1657798

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

@amitchandak 

Apologies for not explaining properly, its my first time here and I am just starting out on Power BI. Thank you for responding. Let me try to explain better:

I am trying to find the target hour per month for each employee, so the formula currently takes the start of the year if the employee start date is before Jan 1 , 2022 however if the employee start date is after Jan 1, 2022 then take the start date to pro-rate the target. Additionally, each employee works a particular amount of days .5 - 5. 

So, the target is 100 hours for each month for an employee that works 5 days. If the employee works 3 days and started Jan 1st their amount would be 60 each month.

If the employee started Jan 15 then their hours would be 50 for Jan and 100 for the rest of the year if they work 5 days if they work 3 days it would be 30 for Jan and 60 for the rest of the year.

The formula does calculate each month correctly if I have a slicer and select the respective months however if I select multiple months it does not add up the target so if I selected Jan, Feb and Mar it should be 300 for an employee that works 5 days and started Jan 1st. So, I am asking for help to see if anyone knows how to do that please?

 

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.