Quantcast
Channel: MAX – Ashish Mathur's Blog
Viewing all articles
Browse latest Browse all 26

Extract farthest/latest date based on multiple conditions

$
0
0

Assume a three column database showing Site ID, Customer, Status and Requested Date.  On the same site ID, the same customer may have different status on different dates.   In such a scenario, one may want to know the farthest/latest requested date and its corresponding status for all unique combinations of Site ID and Customer.

I initially attempted to solve this problem by using a pivot table but the pivot output was incorrect.  The pivot was returning the farthest/latest date for all status' of a particular Site ID and Customer.  Ideally, it should show only the farthest/latest date and its corresponding status for a particular Site ID and Customer.  Therefore, for a particular Site ID and Customer combination, only one row should show up in the final output.  I ultimately solved this problem by using Advanced Filters.

You may download this workbook for a better description of the problem and my workaround.


Viewing all articles
Browse latest Browse all 26

Trending Articles