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

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher 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
Community Champion
Community Champion

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
Community Champion
Community Champion

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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.