Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Calculated Column from Another Table

I have two tables with application ID in both table having relationship.

 

First Table

 

Application IDClosed DateTimeTatClosed Flag
123-09-202130No
124-09-202145Yes
125-09-202156Yes

 

Second Table

 

Application IDTAT (Calculated Col)
156

 

I need to create a calculated column "TAT" in the second table which brings the TAT value for a maximum ClosedDateTime of a Application ID and Closed Flag should be "Yes".

 

Please help me with DAX for this. 

  • Anonymous This is essentially Lookup Min/Max: Lookup Min/Max - Microsoft Power BI Community. In your case:

    TAT Column =
      VAR __Date = MAXX(FILTER(RELATEDTABLE('First Table'),[Closed Flag]="Yes"),[Closed DateTime])
      VAR __Tat = MAXX(FILTER(RELATEDTABLE('First Table'),[Closed Flag]="Yes" && [Closed DateTime]=__Date),[Tat])
    RETURN
      __Tat

1 Reply

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Anonymous This is essentially Lookup Min/Max: Lookup Min/Max - Microsoft Power BI Community. In your case:

    TAT Column =
      VAR __Date = MAXX(FILTER(RELATEDTABLE('First Table'),[Closed Flag]="Yes"),[Closed DateTime])
      VAR __Tat = MAXX(FILTER(RELATEDTABLE('First Table'),[Closed Flag]="Yes" && [Closed DateTime]=__Date),[Tat])
    RETURN
      __Tat