10 Replies Latest reply: Mar 22, 2016 8:55 AM by Jasper Bom RSS

    How to use expressions within multiple If statements

    Jasper Bom

      I am having troubles trying to make a graph work. I am not entirely sure if this is possible, thus me asking here. I have below graph, which has the expression:=Count{<Year='2014','2015','2016'},Month='Jan','Feb','Mrt','Apr','Mei','Jun','Jul','Aug','Sep','Okt','Nov','Dec'}>}DISTINCT sicknumber)

      So it doesnt change with whatever selection has been made in the filters. it always shows 2014, 2015, 2016

      enter image description here

      I want to be able to make the graph non static based on the filter that is given. If I select year 2015 I want to show the previous year and the year after. so when selecting 2013 I want to see 2012, 2013 and 2014. I have made the following expression:

      =if(Jaar=2016,(Count({<Jaar={'2014','2015','2016'},Maand={'jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec'}>}DISTINCT Ziekte_Volgnummer)),

      if(Jaar=2015,(Count({<Jaar={'2013','2014','2015'},Maand={'jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec'}>}DISTINCT Ziekte_Volgnummer)),

      if(Jaar=2014,(Count({<Jaar={'2012','2013','2014'},Maand={'jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec'}>}DISTINCT Ziekte_Volgnummer)),

      if(Jaar=2013,(Count({<Jaar={'2011','2012','2013'},Maand={'jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec'}>}DISTINCT Ziekte_Volgnummer)),

      if(Jaar=2012,(Count({<Jaar={'2011','2012'},Maand={'jan','feb','mrt','apr','mei','jun','jul','aug','sep','okt','nov','dec'}>}DISTINCT Ziekte_Volgnummer)))))))

      it seems however that it ignores the set expression and just show the year given in the filter. How would I go around this.

      When using the same statement to just calculate to total unique values in a text object, it does seem to be able to calculate the correct value there.

      how would I go around this, of is it even possible?

      thanks in advance