Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
2 years ago
Solved

IF or Switch

Hi good day can anyone assist me on my query. I have table, I want the Stutus
"Not Startted" if the date is in coming or in futere
"Delayed" if the date already pass on the end date and the progress is lessthan 100%
"In-progress" if the progress is lessthan 100% and the current date not exceed on the end date

"Completed" if already 100% in Remark column

OUTPUT

Thank you

 

  • Hi AllanBerces 
    You can create a calculated column with the dax :

    Status =
    if('Table'[Remarks]=1,"Completed",
    If ([P1 Sta]>=TODAY(),"Not started",
    if ('Table'[Remarks]<1 && 'Table'[P1 En]<TODAY(),"Delayed",
    if('Table'[Remarks]<1 &&'Table'[P1 En]>=TODAY(), "In progress")
    )))

    The pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

     

4 Replies

  • Hi AllanBerces 
    You can create a calculated column with the dax :

    Status =
    if('Table'[Remarks]=1,"Completed",
    If ([P1 Sta]>=TODAY(),"Not started",
    if ('Table'[Remarks]<1 && 'Table'[P1 En]<TODAY(),"Delayed",
    if('Table'[Remarks]<1 &&'Table'[P1 En]>=TODAY(), "In progress")
    )))

    The pbix is attached

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

     

  • Hi AllanBerces 
    Try this Code

     

    Status =
    VAR _START = 'Table'[P1 Start]
    VAR _END = 'Table'[P1 End]
    VAR _PRO = 'Table'[Remarks]
    VAR _Result =
    SWITCH(TRUE(),
    _START>=TODAY(),"Not Started",
    _PRO=1 && _END<=TODAY(),"Completed",
    _PRO<1 && _END<TODAY(),"Delayed",
    _PRO<1 && _END>=TODAY(),"In-Progress",
    "NO STATUS UPDATE"
    )

    RETURN _Result