Forum Discussion

fahadarshad's avatar
fahadarshad
Icon for Helper I rankHelper I
9 years ago
Solved

Finding amount based on latest date in 2nd table

Hello everyone,

 

I am new to Power BI and this is my first post on this community.

 

Here is my Q.

 

I have two tables

 

Table1   Table 2  
 IDResult  IDAmountDate
1  15Wednesday, January 04, 2017
2  110Thursday, January 05, 2017
3  215Friday, January 06, 2017
4  25Saturday, January 07, 2017
5  325Sunday, January 08, 2017
   450Monday, January 09, 2017
   560Tuesday, January 10, 2017
   5100Wednesday, January 11, 2017
      
      
Result into Table1    
 IDResult    
110    
25    
325    
450    
5100    

10 Replies

  • Phil_Seamark's avatar
    Phil_Seamark
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi fahadarshad

     

    This worked for me on your test data.  I created the following calculation, which takes advantage of the relationship between Table1 and Table2

     

    My Amount = CALCULATE(
    			MAX('Table2'[Amount]),
    			LASTDATE('Table2'[Date])
    			)

     

    • fahadarshad's avatar
      fahadarshad
      Icon for Helper I rankHelper I

      Hi Phil

       

      I am getting an error saying "a date column containing duplicate dates was specified in the call to the function."

      • Phil_Seamark's avatar
        Phil_Seamark
        Icon for Microsoft Employee rankMicrosoft Employee

        Are you loading the measure on your sample dataset, or on a larger dataset?