2 Replies Latest reply: Feb 6, 2014 3:41 PM by Erica Whalley RSS

    Sum expressions with different dimension field but having same dimension value

    Mathias Vanden Auweele

      Hello all,


      I have a problem with resolving the following situation. I have multiple geographic area's that are copied in multiple fields. Let's simplify the problem to two fields:




      So the content of both thoose fields is the same = [Area1, Area2, Area3, ..]


      Let's say I have 2 expressions (in reality they are little bit more complex):




      I can perfectely make a chart that gives me an overview for 1 expression. But I cannot combine both expressions just like that in one chart because the dimensions differ that I have to use for both expressions. What I want to achieve is a chart that gives me:



      Area 1



      Area 2



      Area 3





      I could do this with a data island as dimension and then using a nested if expression and hard coded 'Area x' values in the set analysisses but I've got alot of those area's to cover (not to mention expressions...)


      Does anyone has an idea how to do this better? Thanks!

        • Re: Sum expressions with different dimension field but having same dimension value

          I'm having this exact problem, and am about to go the Data Island route. Does anyone know of a better way to solve this using Set Analysis?

            • Re: Sum expressions with different dimension field but having same dimension value

              Hi both


              In a perfect world you would change the database structure so that the area is somehow in a shared field, eg in a table with the fields


              Responsible ("component or design")




              I'm guessing this is already not possible, so here is my suggestion, without changing the script.


              You can use valuelist() or valueloop() to generate dimension values in a chart, which you can then reference in the expression.


              So your table would look something like this:

              Dimension: valueloop(1,10,1)  (genereates 10 values, 1 to 10)

              Expression: sum(if(component_responsible = 'area' & valuelist(1,10,1),defects_components))

              +sum(if(design_responsible = 'area'&valuelist(1,10,1),defects_design))


              In the first sum() I look at all the data and compare each value of component_responsible to the word "area" followed by the number generated in the dimension.

              Then I do something similar for the design. Above is assuming you have 10 areas, but you can insert a variable into the function that returns the total number of areas.


              Hope this helps.


              On a similar thread (and again much easier) you could create a stand alone table of distinct areas.





              load distinct Component_responsible as Area resident main_table;


              You could then use that as the dimension and perform a similar expression to the one above where you compare your component responsible and design responsible to the stand alone area dimension.