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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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