Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have two tables witg data about locations and tasks. I'm trying to import from Table2, the nearest previous date based on the planned date on Table1 for the Location.
Any ideas on how can I find the nearest previous date from another column based on the "Location"?
Table1
Location | Task | Planned Date |
Home 1 | Cleaning | 03-12-2019 |
Home 1 | Painting | 19-12-2019 |
Home 2 | Painting | 05-12-2019 |
Home 2 | Mowing | 29-12-2019 |
Home 3 | Cleaning | 17-12-2019 |
Home 5 | Cleaning | 18-12-2019 |
Home 7 | Mowing | 22-12-2019 |
Home 8 | Mowing | 29-12-2019 |
Table2
Location | Task Completition |
Home 1 | 01-12-2019 |
Home 1 | 15-12-2019 |
Home 2 | 01-12-2019 |
Home 2 | 23-12-2019 |
Home 3 | 12-12-2019 |
Home 5 | 14-12-2019 |
Home 7 | 19-12-2019 |
Home 8 | 23-12-2019 |
The resulting table should looks as follow:
Location | Task | Planned Date | Task Completition |
Home 1 | Cleaning | 03-12-2019 | 01-12-2019 |
Home 1 | Painting | 19-12-2019 | 15-12-2019 |
Home 2 | Painting | 05-12-2019 | 01-12-2019 |
Home 2 | Mowing | 29-12-2019 | 23-12-2019 |
Home 3 | Cleaning | 17-12-2019 | 12-12-2019 |
Home 5 | Cleaning | 18-12-2019 | 14-12-2019 |
Home 7 | Mowing | 22-12-2019 | 19-12-2019 |
Home 8 | Mowing | 29-12-2019 | 23-12-2019 |
Thanks
Solved! Go to Solution.
@afhs Please use below measure to get the latest completion date
Measure =
VAR _location = MAX(Table1[Location])
VAR _plannedDate = MAX(Table1[Planned Date])
RETURN CALCULATE(MAX(Table2[Task Completition]),Table2[Location]=_location,Table2[Task Completition]<=_plannedDate)
If it helps accept solution.
@afhs Please use below measure to get the latest completion date
Measure =
VAR _location = MAX(Table1[Location])
VAR _plannedDate = MAX(Table1[Planned Date])
RETURN CALCULATE(MAX(Table2[Task Completition]),Table2[Location]=_location,Table2[Task Completition]<=_plannedDate)
If it helps accept solution.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |