Forum Discussion

Alexh84's avatar
Alexh84
Frequent Visitor
1 year ago
Solved

Power BI model

just wondering if someone has a solution to this. I'll try my best to summarise. I have a table that holds referral level data - the referral ID is unique. I use this table to build out a table visua...
  • johnbasha33's avatar
    1 year ago

    Hi Alexh84 

    Your setup:

    • Referral Table (Referral ID is unique — 1 side)

    • Reported Outcomes Table (Multiple rows per Referral ID — many side)

    Relationship:

    Referral (1) ----> (Many) Reported Outcomes

    Get the first completed outcome:
    First Outcome Completed =
    CALCULATE(
    MIN('Reported Outcomes'[Outcome Completed Date]),
    'Reported Outcomes'[Referral ID] = SELECTEDVALUE('Referral'[Referral ID])
    )
    or if you want the corresponding outcome value:
    First Outcome Name =
    VAR FirstDate =
    CALCULATE(
    MIN('Reported Outcomes'[Outcome Completed Date]),
    'Reported Outcomes'[Referral ID] = SELECTEDVALUE('Referral'[Referral ID])
    )
    RETURN
    CALCULATE(
    MAX('Reported Outcomes'[Outcome Name]),
    'Reported Outcomes'[Outcome Completed Date] = FirstDate,
    'Reported Outcomes'[Referral ID] = SELECTEDVALUE('Referral'[Referral ID])
    )


    Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!