7 Replies Latest reply on Aug 4, 2016 11:50 AM by Gilberto Diaz

    Return all rows based on if conditions!!

    Gilberto Diaz

      Greetings to the Tableau community;

      I would like to return all customer's visit based on one condition, however, it is returning the rows with just that condition. Let me explain in more detail. Let say that I have this table

       

        Name | Date | Amount | Payment_Method

       

      And let say that all customers have come to my store more than once, therefore, I have more than one visit per customer. Lets pretend that I have 4 payment methods and I want all the records of those customers that had pay with payment method 3 at least once. I want all the visits of those customers. So the query should return something like this:

       

      customer 1 | visit 1 | $1.00 | 1

      customer 1 | visit 2 | $3.00 | 3

      customer 1 | visit 3 | $2.00 | 2

       

      This is my code:

      IF[payment_method] = 3

      THEN [customer_id]

      ELSE ""

      END

      This code is returning just the records with payment method 3.

      Make sense what I want?