Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Creating a new Date Column based on multiple criteria

Hi,    I need to add SLA dates to a report, which change based on the severity and impact of the item logged, I have a table as below:    Impact Severity Logged Date SLA A 1 01/01/2023...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

    Please try to create a new column with below dax formula:

    SLA =
    VAR _impact = [Impact]
    VAR _sev = [Severity]
    VAR _ld = [Logged Date]
    VAR _year =
        YEAR ( _ld )
    VAR _month =
        MONTH ( _ld )
    VAR _day =
        DAY ( _ld )
    VAR _val =
        SWITCH (
            TRUE (),
            _impact = "A", DATE ( _year, _month + 2, _day ),
            _impact = "B"
                || _impact = "D"
                && _sev IN { 1, 2 }, DATE ( _year, _month + 9, _day ),
            _impact = "C"
                || _impact = "D"
                && _sev IN { 3, 4 }, DATE ( _year, _month + 12, _day )
        )
    RETURN
        _val
    

    Please refer the attached .pbix file.

     

    Best regards,
    Community Support Team_Binbin Yu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.