6 Replies Latest reply: Feb 9, 2018 11:51 AM by EZEQUIEL CONTE RSS

    help set analysis

    EZEQUIEL CONTE

      Hello!
      I need help.
      I have to count a field with certain criteria. The periods (dates) of two fields of different tables must match.

      Script:

      /*Table 1
      company, period_1
      a, 201507
      b, 201508
      c, 201510
      e, 201702
      * /
      Table 1:
      load
      company, // pk
      period_1
      from x (qvd);


      / * table2
      company, period_2, channel
      a, 201507, channel1
      b, 201602, channel2
      c, 201702, channel3
      d, 201605, channel4
      * /
      table2:
      load
      company, // pk
      period_2,
      channel
      from and (qvd);

      The value of period_1 and period_2 comes as 201505, 201506, 201704, etc.
      I am doing the expression in a table / bar chart. I want to do it with set analysis to avoid the if function, but I do not succeed.

      The expression I'm looking for would be something like this:

      Count ({<period_1 = {period_2}>} distinct channel)

      The result I'm looking for is:

      Count channel = 2 (channel1 and channel3)

      Thank you very much!