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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
JonathanGiord
New Member

YTD values to Monthly - based on date and employee ID

Hi all,

 

I have the following table named "Absences", here is a simplified version of it:

 

employee IDKey date (EOM)Sick days (YTD)
128. Feb20
228. Feb3
328. Feb2
131. Mrz25
231. Mrz6
331. Mrz4

 

I would like to create a DAX formula to obtain the Monthly value as stated below in my table: 

 

employee IDKey date (EOM)Sick days (YTD)expected column Monthly
128. Feb2020
228. Feb33
328. Feb22
131. Mrz255
231. Mrz63
331. Mrz42

 

Please note that my data only starts as of February 2023 (no data for Jan 2023), thanks a lot for your help! 

1 ACCEPTED SOLUTION
some_bih
Super User
Super User

Hi @JonathanGiord possible solution, create calculated column; adjust your table name for  Sheet1

YTD SD =
VAR __current_employee = Sheet1[employee ID]
VAR __date_eom = Sheet1[Key date (EOM)]
VAR __previous_row_sick_days =
    CALCULATE (
        SUM ( Sheet1[Sick days (YTD)] ),
        FILTER (
            Sheet1,
            Sheet1[employee ID] = __current_employee
                && Sheet1[Key date (EOM)] < __date_eom
        )
    )
VAR __Result = Sheet1[Sick days (YTD)] - __previous_row_sick_days
RETURN
    __Result
 
Output
some_bih_0-1697009724525.png

Did I answer your question? Kudos appreciated / accept solution!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






View solution in original post

1 REPLY 1
some_bih
Super User
Super User

Hi @JonathanGiord possible solution, create calculated column; adjust your table name for  Sheet1

YTD SD =
VAR __current_employee = Sheet1[employee ID]
VAR __date_eom = Sheet1[Key date (EOM)]
VAR __previous_row_sick_days =
    CALCULATE (
        SUM ( Sheet1[Sick days (YTD)] ),
        FILTER (
            Sheet1,
            Sheet1[employee ID] = __current_employee
                && Sheet1[Key date (EOM)] < __date_eom
        )
    )
VAR __Result = Sheet1[Sick days (YTD)] - __previous_row_sick_days
RETURN
    __Result
 
Output
some_bih_0-1697009724525.png

Did I answer your question? Kudos appreciated / accept solution!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.