-
1. Re: Find the year a value first occurs
Ken FlerlageJun 16, 2019 3:11 PM (in response to Stephen Campbell)
Try the following calculated field:
Year of First 1
// Get the year the first 1 appears for the country.
{FIXED [Country]: MIN(IIF([Treaty of Tlatelolco]=1, [Year],NULL))}
See attached.
-
Countries.twbx 13.0 KB
-
-
2. Re: Find the year a value first occurs
Stephen Campbell Jun 19, 2019 9:50 PM (in response to Ken Flerlage)Thank you so much!!!!
-
3. Re: Find the year a value first occurs
Stephen Campbell Jun 19, 2019 10:11 PM (in response to Stephen Campbell)How would I change it so if the value is 2 in the year 1967, to set the output to 1967? Here's what I tried:
// Get the year the first 1 appears for the country.
{FIXED [Country]:
IF [Treaty of Tlatelolco]=2 AND [Year]=1967
THEN 1967
ELSE(IIF([Treaty of Tlatelolco]=1, [Year],NULL)) END}
-
4. Re: Find the year a value first occurs
Ken FlerlageJun 20, 2019 7:19 AM (in response to Stephen Campbell)
That looks like it would work.
-
5. Re: Find the year a value first occurs
Stephen Campbell Jun 20, 2019 8:48 AM (in response to Ken Flerlage)I'm getting an "result of a detail expression must be an aggregate" error returned.
-
6. Re: Find the year a value first occurs
Ken FlerlageJun 20, 2019 9:37 AM (in response to Stephen Campbell)
Oh, right, the second part of an LOD needs to do an aggregation, so try this:
// Get the year the first 1 appears for the country.
{FIXED [Country]:
MIN(IF [Treaty of Tlatelolco]=2 AND [Year]=1967
THEN 1967
ELSE(IIF([Treaty of Tlatelolco]=1, [Year],NULL)) END)}