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: 

 

ImpactSeverityLogged DateSLA
A101/01/2023=Logged Date+2 months
A201/01/2023=Logged Date+2 months
A301/01/2023=Logged Date+2 months
A401/01/2023=Logged Date+2 months
B101/01/2023=Logged Date+9 months
B201/01/2023=Logged Date+9 months
B301/01/2023=Logged Date+9 months
B401/01/2023=Logged Date+9 months
D101/01/2023=Logged Date+9 months
D201/01/2023=Logged Date+9 months
C101/01/2023=Logged Date+12 months
C201/01/2023=Logged Date+12 months
C301/01/2023=Logged Date+12 months
C401/01/2023=Logged Date+12 months
D301/01/2023=Logged Date+12 months
D401/01/2023=Logged Date+12 months

 

Would someone be able to help me work out how to add the SLA date based on the other 2 criteria?

  • 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.

2 Replies

  • Please describe the rules for considering impact and severity.

  • Anonymous's avatar
    Anonymous
    Not applicable

    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.