Need help on my SQL

  • Hi there, I need help to use SQL to pull data from SQL Server and feed it to Tableau as data source, but I am stuck and not sure what to do.  Here is the requirements for the report.

    Assume I run the report on Tableau dashboard today (04/08/2021) (Note: user can select the report period start date within the past 2 years and report period start date is always the first day of the month, but cannot be current month)

    Report period start date: 03/01/2021

    Report period end date: 03/31/2021 (always the last day of the report period start date month)

    If the member enrolled in contract A & B and never enrolled before or contract was ended more than 12 months ago, consider the member is new to plan. OR

    If the member enrolled in contract C and never enrolled before or contract was ended more than 120 days ago, consider the member is new to plan.

    Need to show the member is new to plan that based on the report period start date month.

    What should I do to approach this question? Any tips or advise is welcomed. Thank you.

  • I have not used Tableau, but I THINK the tool is designed to handle large data sets and process them to display to the end user.  So I would pull in all of the data from SQL Server that is required for the report (member, contract, enrollment date, period date, anything else you need) and then in Tableau build the report to handle the filters you need.

    Now, I imagine end users won't be looking at ALL data, so when you pull the data in, you MAY want to filter it to the past quarter or past year (depending on end user requirements).  If you are pulling in 100 years of data (for example) and you have that refreshing daily (or hourly or whatever your requirement is), you are likely going to have large periods of time with no data.  If you pull in a smaller data set, you should get better performance.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply