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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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