Dynamic intersection of sets (Set Analysis)

    I've seen quite some times, people asking for intersection for some sort of behaviour that would enable them to make selections and based on them, to see the values (a dimension example could be product type) that are mutual for all the selections made.

     

    As examples, we would have this kind of post in the community:

    Set analysis permits this sort of thing, but you would have to explicitly input some dimension value, as in the bellow code

     

    =count (distinct  {<code = P ({<exam={"1"}>} code ) >*<code = P ({<exam={"2"}>} code ) > } code )


    to be able to do the intersection.


    I've developed an automatic way to do it, simply by building each set and then concatenating them (can be expanded to more variables).

    I understand that with each additional set of the selection, it can be quite consuming to make the calculations.

    My example is quite simple, so it takes no time at all to compute what I've built.

     

    Selections made on 'Dim2'  field will show the intersected values for 'Dim1'

    Example:

    Selecting the values 'X' and 'Y' in 'Dim2'  field, should give on the righmost table, the values that are intersected for X and Y, giving the following image:

    Sample.png


    Hope it helps someone, it was quite fun to try it out.

     

    Update: just added code so that the expression is made automatically.

     

    Felipe.