Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have the following dataset:
BOOKSUBJECT BOOKNAME PUBLICATIONYEAR
A Book1 2011
B Book2 2010
C Book3 2010
D Book1 2011
A Book5 2008
B Book2 2009
I’m attempting to derive the minimum PUBLICATIONYEAR year for each BOOKSUBJECT. I was able to do this as its own formula (in its own column in a straight table)
aggr(min(PUBLICATIONYEAR),BOOKSUBJECT)
However when I attempt to set that minimum PUBLICATION YEAR value into Set Analysis to count how many BOOKNAMEs have that BOOKSUBJECT only in that minimum/first year, it ignores the per row/BOOKSUBJECT value and just takes the minimum PUBLICATIONYEAR for the entire data set. Here is as close as I got….
count({<PUBLICATIONYEAR = {"=$(#=min(aggr(min(PUBLICATIONYEAR), BOOKSUBJECT)))"} >}BOOKNAME)
So for the dataset above, when I attempt to count BOOKNAMES per BOOKSUBJECT for the minimum PUBLICATIONYEAR, I get a value of 2008 for *all* BOOKSUBJECTS even though I’m trying to get 2008 for BOOKSUBJECT A, but 2009 for BOOKSUBJECT B, etc…
Any ideas?
I tried this and I get mostly zeros... I figured out a 'dirty' workaround. The PUBLICATION YEARS only go back 5 years, so I was able to use nested IFs to check to see which year the the publications started for each term and then count the BOOKNAME for that year as the 'minimum'.
if(count({<PUBLICATIONYEAR = {"<=$(=min(PUBLICATIONYEAR)+1)"} >}BOOKNAME) > 0 , count({<PUBLICATIONYEAR = {"<=$(#=min(PUBLICATIONYEAR)+1)"} >}BOOKNAME)) ,
if(count({<PUBLICATIONYEAR = {"<=$(=min(PUBLICATIONYEAR)+2)"} >}BOOKNAME) > 0 , count({<PUBLICATIONYEAR = {"<=$(#=min(PUBLICATIONYEAR)+2)"} >}BOOKNAME)) ,
if(count({<PUBLICATIONYEAR = {"<=$(=min(PUBLICATIONYEAR)+3)"} >}BOOKNAME) > 0 , count({<PUBLICATIONYEAR = {"<=$(#=min(PUBLICATIONYEAR)+3)"} >}BOOKNAME)) ,
if(count({<PUBLICATIONYEAR = {"<=$(=min(PUBLICATIONYEAR)+4)"} >}BOOKNAME) > 0 , count({<PUBLICATIONYEAR = {"<=$(#=min(PUBLICATIONYEAR)+4)"} >}BOOKNAME)) ,
if(count({<PUBLICATIONYEAR = {"<=$(=min(PUBLICATIONYEAR)+5)"} >}BOOKNAME) > 0 , count({<PUBLICATIONYEAR = {"<=$(#=min(PUBLICATIONYEAR)+5)"} >}BOOKNAME)) ,
count({<PUBLICATIONYEAR = {"<=$(#=min(PUBLICATIONYEAR))"} >}BOOKNAME)
Clearly In this case SET Analysis wont work because SET analysis work on entire table not row level. In this case the Min Year change every row.