
1. Re: Find Last Corresponding Values in Current Table
Andrew Watson Jul 7, 2016 5:45 PM (in response to Justin Stanley)1 of 1 people found this helpfulNot easy...and I don't have tableau handy so am freestyling this response somewhat. First you use an LOD calc to get the latest date for each Item:
{FIXED [ItemID]:MAX([Date])}
Then return the Key for each max date:
IF [Date] = {FIXED [ItemID]:MAX([Date])} THEN [Key] END
That may do it, but I suspect not, I think you may then need to use a table calc, something like WINDOW_MAX(MAX(IF [Date] = {FIXED [ItemID]:MAX([Date])} THEN [Key] END))
This earlier thread may help and I'll try and dig out other examples of this type of problem: How to lookup and update a new column with a particular row value
The LOD part should get you most of the way but I suspect the table calc may also be unavoidable and may (probably will) need tweaking from what I've suggested.

2. Re: Find Last Corresponding Values in Current Table
swaroop.gantela Jul 7, 2016 8:15 PM (in response to Justin Stanley)Justin,
Please see if the attached could be a first step for you.
I broke it up into three calculated fields.The first returns all dates that have a key:
IF NOT(ISNULL([Key])) THEN [Date] END
The next uses a Level of Detail calculation to get the maximum date available for each Item ID:
{ FIXED [Item ID]:MAX([DateWithKey])}
Then the Key of that MaxDate is obtained:
{ FIXED [Item ID]:MAX(IF [Date]=[MaxDatePerID] THEN [Key] END)}

210676key.twbx 26.1 KB


3. Re: Find Last Corresponding Values in Current Table
swaroop.gantela Jul 7, 2016 8:18 PM (in response to Andrew Watson)Andrew,
Apologies, didn't see that you had already replied.

4. Re: Find Last Corresponding Values in Current Table
Justin Stanley Jul 8, 2016 8:50 AM (in response to swaroop.gantela)Thanks, Andrew Watson and swaroop.gantela! This is perfect. Turns out I was on the right track and was soooo close myself, but just couldn't figure out that last step Swaroop mentioned. This ties it all together very nicely.