Forum Discussion

heygowtam's avatar
heygowtam
Helper II
3 years ago
Solved

Measure or calculated column for multiple column condition

I have two Columns [employment Type], [start Date] need to Generate another [Leave ] column Based on the following Condition, 1) if the Employee type is "Full Time" and started the previous Fin...
  • danextian's avatar
    danextian
    3 years ago

    Hello,

     

    Please change your formula to this:

    Leave Credits =
    VAR emptype = 'Table'[Employment Type]
    VAR startdate = 'Table'[Start Date]
    VAR date1 =
        DATE ( 2022, 7, 1 )
    VAR date2 =
        EDATE ( date1, 12 ) - 1
    VAR annuacredits =
        IF ( emptype = "Full Time", 20, 12 )
    VAR monthlycredits =
        IF ( emptype = "Full Time", 1.67, 1 )
    VAR remainingmonths =
        DATEDIFF ( 'Table'[Start Date], date2, MONTH )
    RETURN
        IF (
            'Table'[Start Date] < date1,
            annuacredits,
            remainingmonths * monthlycredits
        )