Forum Discussion
fahadarshad
Helper I
9 years agoFinding 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 | ||||
| ID | Result | ID | Amount | Date | |
| 1 | 1 | 5 | Wednesday, January 04, 2017 | ||
| 2 | 1 | 10 | Thursday, January 05, 2017 | ||
| 3 | 2 | 15 | Friday, January 06, 2017 | ||
| 4 | 2 | 5 | Saturday, January 07, 2017 | ||
| 5 | 3 | 25 | Sunday, January 08, 2017 | ||
| 4 | 50 | Monday, January 09, 2017 | |||
| 5 | 60 | Tuesday, January 10, 2017 | |||
| 5 | 100 | Wednesday, January 11, 2017 | |||
| Result into Table1 | |||||
| ID | Result | ||||
| 1 | 10 | ||||
| 2 | 5 | ||||
| 3 | 25 | ||||
| 4 | 50 | ||||
| 5 | 100 |
10 Replies
- Phil_Seamark
Microsoft 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
Helper 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
Microsoft Employee
Are you loading the measure on your sample dataset, or on a larger dataset?