1 Reply Latest reply on Apr 17, 2018 10:29 AM by Hari Ankem

    SQL and Tableau Logic

    chowdary v

      Hi, here I attached sample workbook,

       

      how to write below logic in SQL and tableau,

       

      In the SQL, Create new select columns called BlendedRevenue and BlendedRevenueRunrate. The logic for these columns is to pull either expected value (lead revenue)

      or revenue based on the product and date. Logic is:

      For Business loans, pull expectedLeadRevenue instead of matched count

      For Personal Loans and Auto Loans:

      -- if it is after the 10th of the month, pull expected revenue for the last month and current month, otherwise matchedRevenue

      -- if it is before the 10th of the month, pull expected revenue for last 2 months + current month

      for all other products, pull matched revenue.

       

       

      Thanks,

      Veeru

        • 1. Re: SQL and Tableau Logic
          Hari Ankem

          For the sample data you provided, you should also provide the expected output too.

           

          Anyway, I feel that your business logic is both flawed and not clear. Please check the following statements:

           

          For Personal Loans and Auto Loans:

          -- if it is after the 10th of the month, pull expected revenue for the last month and current month, otherwise matchedRevenue

          -- if it is before the 10th of the month, pull expected revenue for last 2 months + current month

           

          1. What do you mean by Expected Revenue for the last month and current month? Do you mean the average/sum or something else?

          2. Also, in the same line you have stated to use Matched Revenue with an "otherwise" clause. Isn't this conflicting with the 2nd line of your requirement?

          3. When you state last month, do you plan to summarize the data at a monthly level and then consider the last month data, or consider the last month for each transaction at the date level.

          4. What happens on 10th?