Forum Discussion

gauravnarchal's avatar
gauravnarchal
Post Prodigy
4 years ago
Solved

Calculated Column

Hello - I need help in creating a calculated column to return:-   If Purchase Order = “Email” or “TBA” or “TBC” and Reason is “Blank” Return “Pending PO” If Purchase Order has one digit value  and...
  • parry2k's avatar
    4 years ago

    gauravnarchal add a new column using following DAX and it will do it, you can always tweak it as you see fit:

     

    Status = 
    VAR __PO = PO[PurchaseOrder]
    VAR __Reason = COALESCE ( PO[Reason], "" )
    VAR __isNumber = NOT ( IFERROR ( VALUE ( SUBSTITUTE ( PO[PurchaseOrder], "/", "" ) ), BLANK() ) == BLANK() )
    RETURN
    SWITCH ( TRUE(),
        __PO IN { "Email", "TBA", "TBC" } && __Reason = "", "Pending PO",
        __isNumber && __Reason = "", "Uploaded in Progress",
        ( __isNumber && __Reason = "Uploaded") || ( LEFT ( __PO, 2 ) = "DW" ), "Uploaded",
        "Error"
    )

     

    Follow us on LinkedIn

     

    Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

     

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.