Forum Discussion

Urumita's avatar
Urumita
Frequent Visitor
3 years ago
Solved

Create boolean calculated column based on related table

Hi all,   I need help with the following issue:  My Data model has a table production items on the one side and Production steps on the other. Each Item goes through different steps in the product...
  • SivaMani's avatar
    SivaMani
    3 years ago

    Urumita, Try the below steps,

    • Add Status Code (Numeric)
      1. Success = 1
      2. In Progress = 2
      3. Faile = 3

    • Create a Calculated Column in Item TBL_Items like below,

     

     

    Status = 
        VAR StatusCode  = CALCULATE(MAX('TBL_Process'[Status Code]), RELATEDTABLE('TBL_Process'))
        VAR Result = SWITCH(
            StatusCode,
            1,
            "Success",
            3,
            "Fail",
            "In Progress"
    )
    RETURN
    Result

     

     

     

    Note: Make sure that you created a relationship between the tables.

     

     

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

    Appreciate your Kudos!

    MCT | Power BI Analyst | Azure Data Engineer

    LinkedIn