1 Reply Latest reply on Sep 30, 2018 9:25 AM by Jeevan Krishna

    Filtering customers by number of orders matching a regex

    Fabrizio Bianchi

      Hi everyone!

       

      I am having a block (or should I say several) thinking about how to filter a dimension variable using a minimum amount of times a related variable matches one of many strings.

       

      I realize this is difficult to put in a descriptive sentence, so I will take the Superstore as an example:

       

      There I would like to include in a list only the Customer Names of the people who have in their records at least 2 orders of products whose names contain "Apple" or "Accos" or "Logitech".

       

      I already get blocked at the multiple string matching, but in my head I would go like this:

       

      1. Create a Calculated Field that returns 1 when the matching is True (Order matching)

      2. Create a Calculated Field that returns True when the count of Order Matching is 2 or more (Threshold met)

      3. I would filter then a list containing Customer Names by Threshold Met = True.

       

      Sorry for the very newbie question, but the matching is very difficult to figure out and I want to make sure that I am following the right logic.

       

      I am working on Desktop 2018.2.2 64-bit and examples can use Superstore or EU Superstore.

       

      Thanks in advance!

        • 1. Re: Filtering customers by number of orders matching a regex
          Jeevan Krishna

          Hi Fabrizio

           

          Following are the calculated fields and filters I have used based on the description you have provided.

           

          Created a contains based condition to find if the words are present in product names. I am not good at regex but you can use regex_match in case of your conditions.

           

          Since you have asked the counts of each product bought I have included product name as part of the calculation. If you wanted any of the 3 products, then product name can be removed from the calculation.

           

           

          You can use the above filter.

           

          Hope this helps. We can discuss on how it works if you are ok with the solution.

          1 of 1 people found this helpful