***** This metric gives me all the days and not only the last day But if I replace the 'Head Count'[Date] = lastDay for 'Head Count'[Date] = Date(2020,05,31) it works and I get only the value for the day.
your lastDay variable is calculated in the filter context. you need to break out of that if you truly want to find the single last day in your table B. Use CALCULATE, with an ALL() filter thrown in for good measure (no pun intended). Adjust as needed depending on your data model.