Turning Records by Date Range into Records by Day/Month Using SQL Server or Vertica
I can use either SQL Server or Vertica as the DB and Tableau as the reporting tool. A solution in any of these mediums would be helpful.
DATA RESOURCES:
I have a table (userActivity) with 100 records and a structure of: User, StartDate, EndDate
NEED:
I am interested in preparing reports by day and month that show "total active days", meaning if User1 has a range of '20180101' to '20180331', they will contribute one day for each day in Jan, Feb and Mar OR 31, 28 and 31 days if aggregated by month.
GOAL:
I will ultimately be aggregating the total active days of all users as the output to achieve a single total for each day/month.
This report will span to perpetuity, so I would prefer solutions that don't hard code CASE/IF-THEN statements by day/month.
Thanks!
sql sql-server tsql tableau vertica
add a comment |
I can use either SQL Server or Vertica as the DB and Tableau as the reporting tool. A solution in any of these mediums would be helpful.
DATA RESOURCES:
I have a table (userActivity) with 100 records and a structure of: User, StartDate, EndDate
NEED:
I am interested in preparing reports by day and month that show "total active days", meaning if User1 has a range of '20180101' to '20180331', they will contribute one day for each day in Jan, Feb and Mar OR 31, 28 and 31 days if aggregated by month.
GOAL:
I will ultimately be aggregating the total active days of all users as the output to achieve a single total for each day/month.
This report will span to perpetuity, so I would prefer solutions that don't hard code CASE/IF-THEN statements by day/month.
Thanks!
sql sql-server tsql tableau vertica
I believe I've figured it out! :) I am using the following code to create a final table with one record per user per active day. I will then count these by day or month in Tableau. Please, see below.
– Andrew Glenn
Nov 16 '18 at 0:54
add a comment |
I can use either SQL Server or Vertica as the DB and Tableau as the reporting tool. A solution in any of these mediums would be helpful.
DATA RESOURCES:
I have a table (userActivity) with 100 records and a structure of: User, StartDate, EndDate
NEED:
I am interested in preparing reports by day and month that show "total active days", meaning if User1 has a range of '20180101' to '20180331', they will contribute one day for each day in Jan, Feb and Mar OR 31, 28 and 31 days if aggregated by month.
GOAL:
I will ultimately be aggregating the total active days of all users as the output to achieve a single total for each day/month.
This report will span to perpetuity, so I would prefer solutions that don't hard code CASE/IF-THEN statements by day/month.
Thanks!
sql sql-server tsql tableau vertica
I can use either SQL Server or Vertica as the DB and Tableau as the reporting tool. A solution in any of these mediums would be helpful.
DATA RESOURCES:
I have a table (userActivity) with 100 records and a structure of: User, StartDate, EndDate
NEED:
I am interested in preparing reports by day and month that show "total active days", meaning if User1 has a range of '20180101' to '20180331', they will contribute one day for each day in Jan, Feb and Mar OR 31, 28 and 31 days if aggregated by month.
GOAL:
I will ultimately be aggregating the total active days of all users as the output to achieve a single total for each day/month.
This report will span to perpetuity, so I would prefer solutions that don't hard code CASE/IF-THEN statements by day/month.
Thanks!
sql sql-server tsql tableau vertica
sql sql-server tsql tableau vertica
edited Nov 19 '18 at 20:02
Andrew Glenn
asked Nov 15 '18 at 19:44
Andrew GlennAndrew Glenn
289
289
I believe I've figured it out! :) I am using the following code to create a final table with one record per user per active day. I will then count these by day or month in Tableau. Please, see below.
– Andrew Glenn
Nov 16 '18 at 0:54
add a comment |
I believe I've figured it out! :) I am using the following code to create a final table with one record per user per active day. I will then count these by day or month in Tableau. Please, see below.
– Andrew Glenn
Nov 16 '18 at 0:54
I believe I've figured it out! :) I am using the following code to create a final table with one record per user per active day. I will then count these by day or month in Tableau. Please, see below.
– Andrew Glenn
Nov 16 '18 at 0:54
I believe I've figured it out! :) I am using the following code to create a final table with one record per user per active day. I will then count these by day or month in Tableau. Please, see below.
– Andrew Glenn
Nov 16 '18 at 0:54
add a comment |
3 Answers
3
active
oldest
votes
While recursive CTEs are a good candidate for this scenario, it can be handled with tableau alone. Assuming you have this data, here are the steps required to produce the view.
- Create a reference sheet which has all the days expected. Even if you need to cover 25 years from 01/01/2018 to 01/01/2043, that is still less than 10k rows.
You need two columns with exact same date as Tableau does not allow multiple join conditions on same column.
Create an inner join between reference calendar and data using following criteria.
Build the view
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
add a comment |
Use Vertica - it has the TIMESERIES clause - no recursion needed.
I would try the below - and check the intermediate results of the Common Table Expressions to see how it works..
WITH
-- two test rows ....
input(uid,start_dt,end_dt) AS (
SELECT 1,DATE '2018-01-01', DATE '2018-03-31'
UNION ALL SELECT 2,DATE '2018-02-01', DATE '2018-04-01'
)
,
-- set the stage for Vertica's TIMESERIES clause
-- note: TIMESERIES relies on timestamps ...
limits(uid,lim_dt,qty) AS (
SELECT
uid
, start_dt::TIMESTAMP
, 1
FROM input
UNION ALL
SELECT
uid
, end_dt::TIMESTAMP
, 1
FROM input
)
,
-- apply the Vertica TIMESERIES clause
counters AS (
SELECT
uid
, act_dt
, TS_FIRST_VALUE(qty) AS qty
FROM limits
TIMESERIES act_dt AS '1 DAY' OVER(PARTITION BY uid ORDER BY lim_dt)
)
SELECT
uid
, MONTH(act_dt) AS activity_month
, SUM(qty)
FROM counters
GROUP BY 1,2;
-- out uid | activity_month | sum
-- out -----+----------------+-----
-- out 1 | 1 | 31
-- out 1 | 2 | 28
-- out 1 | 3 | 31
-- out 2 | 2 | 28
-- out 2 | 3 | 31
-- out 2 | 4 | 1
-- out (6 rows)
-- out
-- out time: first fetch (6 rows): 120.515 ms. all rows formatted: 120.627 ms
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
add a comment |
Solution:
WITH base AS (
SELECT
User AS u
,StartDate AS s
,EndDate AS e
,DATEDIFF(
dd,
StartDate,
EndDate
)+1 AS d
FROM userActivity
),
recurse AS (
SELECT u, s, e, d, x=(d-1)
FROM base
UNION ALL
SELECT u, s, e, d, x-1 AS x
FROM recurse
WHERE x>0
)
SELECT u, DATEADD(dd, x, s) AS recordperday
FROM recurse
ORDER BY u, recordperday
--Extends SQL Server's recursion limit
OPTION (MAXRECURSION 500)
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326856%2fturning-records-by-date-range-into-records-by-day-month-using-sql-server-or-vert%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
While recursive CTEs are a good candidate for this scenario, it can be handled with tableau alone. Assuming you have this data, here are the steps required to produce the view.
- Create a reference sheet which has all the days expected. Even if you need to cover 25 years from 01/01/2018 to 01/01/2043, that is still less than 10k rows.
You need two columns with exact same date as Tableau does not allow multiple join conditions on same column.
Create an inner join between reference calendar and data using following criteria.
Build the view
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
add a comment |
While recursive CTEs are a good candidate for this scenario, it can be handled with tableau alone. Assuming you have this data, here are the steps required to produce the view.
- Create a reference sheet which has all the days expected. Even if you need to cover 25 years from 01/01/2018 to 01/01/2043, that is still less than 10k rows.
You need two columns with exact same date as Tableau does not allow multiple join conditions on same column.
Create an inner join between reference calendar and data using following criteria.
Build the view
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
add a comment |
While recursive CTEs are a good candidate for this scenario, it can be handled with tableau alone. Assuming you have this data, here are the steps required to produce the view.
- Create a reference sheet which has all the days expected. Even if you need to cover 25 years from 01/01/2018 to 01/01/2043, that is still less than 10k rows.
You need two columns with exact same date as Tableau does not allow multiple join conditions on same column.
Create an inner join between reference calendar and data using following criteria.
Build the view
While recursive CTEs are a good candidate for this scenario, it can be handled with tableau alone. Assuming you have this data, here are the steps required to produce the view.
- Create a reference sheet which has all the days expected. Even if you need to cover 25 years from 01/01/2018 to 01/01/2043, that is still less than 10k rows.
You need two columns with exact same date as Tableau does not allow multiple join conditions on same column.
Create an inner join between reference calendar and data using following criteria.
Build the view
edited Nov 16 '18 at 12:41
answered Nov 16 '18 at 12:35
Jose CherianJose Cherian
3,31812327
3,31812327
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
add a comment |
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
I assumed a Tableau solution was available, but for me, much of Tableau is still quite convoluted. Thanks for illuminating this functionality, Jose!
– Andrew Glenn
Nov 16 '18 at 17:17
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
Love the detailed description, by the way!
– Andrew Glenn
Nov 16 '18 at 19:38
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
@AndrewGlenn, glad it helped. It was a nice question and I enjoyed answering it.
– Jose Cherian
Nov 16 '18 at 20:29
add a comment |
Use Vertica - it has the TIMESERIES clause - no recursion needed.
I would try the below - and check the intermediate results of the Common Table Expressions to see how it works..
WITH
-- two test rows ....
input(uid,start_dt,end_dt) AS (
SELECT 1,DATE '2018-01-01', DATE '2018-03-31'
UNION ALL SELECT 2,DATE '2018-02-01', DATE '2018-04-01'
)
,
-- set the stage for Vertica's TIMESERIES clause
-- note: TIMESERIES relies on timestamps ...
limits(uid,lim_dt,qty) AS (
SELECT
uid
, start_dt::TIMESTAMP
, 1
FROM input
UNION ALL
SELECT
uid
, end_dt::TIMESTAMP
, 1
FROM input
)
,
-- apply the Vertica TIMESERIES clause
counters AS (
SELECT
uid
, act_dt
, TS_FIRST_VALUE(qty) AS qty
FROM limits
TIMESERIES act_dt AS '1 DAY' OVER(PARTITION BY uid ORDER BY lim_dt)
)
SELECT
uid
, MONTH(act_dt) AS activity_month
, SUM(qty)
FROM counters
GROUP BY 1,2;
-- out uid | activity_month | sum
-- out -----+----------------+-----
-- out 1 | 1 | 31
-- out 1 | 2 | 28
-- out 1 | 3 | 31
-- out 2 | 2 | 28
-- out 2 | 3 | 31
-- out 2 | 4 | 1
-- out (6 rows)
-- out
-- out time: first fetch (6 rows): 120.515 ms. all rows formatted: 120.627 ms
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
add a comment |
Use Vertica - it has the TIMESERIES clause - no recursion needed.
I would try the below - and check the intermediate results of the Common Table Expressions to see how it works..
WITH
-- two test rows ....
input(uid,start_dt,end_dt) AS (
SELECT 1,DATE '2018-01-01', DATE '2018-03-31'
UNION ALL SELECT 2,DATE '2018-02-01', DATE '2018-04-01'
)
,
-- set the stage for Vertica's TIMESERIES clause
-- note: TIMESERIES relies on timestamps ...
limits(uid,lim_dt,qty) AS (
SELECT
uid
, start_dt::TIMESTAMP
, 1
FROM input
UNION ALL
SELECT
uid
, end_dt::TIMESTAMP
, 1
FROM input
)
,
-- apply the Vertica TIMESERIES clause
counters AS (
SELECT
uid
, act_dt
, TS_FIRST_VALUE(qty) AS qty
FROM limits
TIMESERIES act_dt AS '1 DAY' OVER(PARTITION BY uid ORDER BY lim_dt)
)
SELECT
uid
, MONTH(act_dt) AS activity_month
, SUM(qty)
FROM counters
GROUP BY 1,2;
-- out uid | activity_month | sum
-- out -----+----------------+-----
-- out 1 | 1 | 31
-- out 1 | 2 | 28
-- out 1 | 3 | 31
-- out 2 | 2 | 28
-- out 2 | 3 | 31
-- out 2 | 4 | 1
-- out (6 rows)
-- out
-- out time: first fetch (6 rows): 120.515 ms. all rows formatted: 120.627 ms
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
add a comment |
Use Vertica - it has the TIMESERIES clause - no recursion needed.
I would try the below - and check the intermediate results of the Common Table Expressions to see how it works..
WITH
-- two test rows ....
input(uid,start_dt,end_dt) AS (
SELECT 1,DATE '2018-01-01', DATE '2018-03-31'
UNION ALL SELECT 2,DATE '2018-02-01', DATE '2018-04-01'
)
,
-- set the stage for Vertica's TIMESERIES clause
-- note: TIMESERIES relies on timestamps ...
limits(uid,lim_dt,qty) AS (
SELECT
uid
, start_dt::TIMESTAMP
, 1
FROM input
UNION ALL
SELECT
uid
, end_dt::TIMESTAMP
, 1
FROM input
)
,
-- apply the Vertica TIMESERIES clause
counters AS (
SELECT
uid
, act_dt
, TS_FIRST_VALUE(qty) AS qty
FROM limits
TIMESERIES act_dt AS '1 DAY' OVER(PARTITION BY uid ORDER BY lim_dt)
)
SELECT
uid
, MONTH(act_dt) AS activity_month
, SUM(qty)
FROM counters
GROUP BY 1,2;
-- out uid | activity_month | sum
-- out -----+----------------+-----
-- out 1 | 1 | 31
-- out 1 | 2 | 28
-- out 1 | 3 | 31
-- out 2 | 2 | 28
-- out 2 | 3 | 31
-- out 2 | 4 | 1
-- out (6 rows)
-- out
-- out time: first fetch (6 rows): 120.515 ms. all rows formatted: 120.627 ms
Use Vertica - it has the TIMESERIES clause - no recursion needed.
I would try the below - and check the intermediate results of the Common Table Expressions to see how it works..
WITH
-- two test rows ....
input(uid,start_dt,end_dt) AS (
SELECT 1,DATE '2018-01-01', DATE '2018-03-31'
UNION ALL SELECT 2,DATE '2018-02-01', DATE '2018-04-01'
)
,
-- set the stage for Vertica's TIMESERIES clause
-- note: TIMESERIES relies on timestamps ...
limits(uid,lim_dt,qty) AS (
SELECT
uid
, start_dt::TIMESTAMP
, 1
FROM input
UNION ALL
SELECT
uid
, end_dt::TIMESTAMP
, 1
FROM input
)
,
-- apply the Vertica TIMESERIES clause
counters AS (
SELECT
uid
, act_dt
, TS_FIRST_VALUE(qty) AS qty
FROM limits
TIMESERIES act_dt AS '1 DAY' OVER(PARTITION BY uid ORDER BY lim_dt)
)
SELECT
uid
, MONTH(act_dt) AS activity_month
, SUM(qty)
FROM counters
GROUP BY 1,2;
-- out uid | activity_month | sum
-- out -----+----------------+-----
-- out 1 | 1 | 31
-- out 1 | 2 | 28
-- out 1 | 3 | 31
-- out 2 | 2 | 28
-- out 2 | 3 | 31
-- out 2 | 4 | 1
-- out (6 rows)
-- out
-- out time: first fetch (6 rows): 120.515 ms. all rows formatted: 120.627 ms
answered Nov 16 '18 at 16:19
marcothesanemarcothesane
1,6111512
1,6111512
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
add a comment |
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
Excellent Vertica based solution. I like having options depending on the back end requirements. I also prefer using Vertica in many cases. Well done!
– Andrew Glenn
Nov 16 '18 at 17:15
add a comment |
Solution:
WITH base AS (
SELECT
User AS u
,StartDate AS s
,EndDate AS e
,DATEDIFF(
dd,
StartDate,
EndDate
)+1 AS d
FROM userActivity
),
recurse AS (
SELECT u, s, e, d, x=(d-1)
FROM base
UNION ALL
SELECT u, s, e, d, x-1 AS x
FROM recurse
WHERE x>0
)
SELECT u, DATEADD(dd, x, s) AS recordperday
FROM recurse
ORDER BY u, recordperday
--Extends SQL Server's recursion limit
OPTION (MAXRECURSION 500)
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
add a comment |
Solution:
WITH base AS (
SELECT
User AS u
,StartDate AS s
,EndDate AS e
,DATEDIFF(
dd,
StartDate,
EndDate
)+1 AS d
FROM userActivity
),
recurse AS (
SELECT u, s, e, d, x=(d-1)
FROM base
UNION ALL
SELECT u, s, e, d, x-1 AS x
FROM recurse
WHERE x>0
)
SELECT u, DATEADD(dd, x, s) AS recordperday
FROM recurse
ORDER BY u, recordperday
--Extends SQL Server's recursion limit
OPTION (MAXRECURSION 500)
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
add a comment |
Solution:
WITH base AS (
SELECT
User AS u
,StartDate AS s
,EndDate AS e
,DATEDIFF(
dd,
StartDate,
EndDate
)+1 AS d
FROM userActivity
),
recurse AS (
SELECT u, s, e, d, x=(d-1)
FROM base
UNION ALL
SELECT u, s, e, d, x-1 AS x
FROM recurse
WHERE x>0
)
SELECT u, DATEADD(dd, x, s) AS recordperday
FROM recurse
ORDER BY u, recordperday
--Extends SQL Server's recursion limit
OPTION (MAXRECURSION 500)
Solution:
WITH base AS (
SELECT
User AS u
,StartDate AS s
,EndDate AS e
,DATEDIFF(
dd,
StartDate,
EndDate
)+1 AS d
FROM userActivity
),
recurse AS (
SELECT u, s, e, d, x=(d-1)
FROM base
UNION ALL
SELECT u, s, e, d, x-1 AS x
FROM recurse
WHERE x>0
)
SELECT u, DATEADD(dd, x, s) AS recordperday
FROM recurse
ORDER BY u, recordperday
--Extends SQL Server's recursion limit
OPTION (MAXRECURSION 500)
answered Nov 16 '18 at 0:54
Andrew GlennAndrew Glenn
289
289
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
add a comment |
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
While the first solution available to me (and the one I devised), this option clearly seems inferior to the others, assuming access to Tableau or Vertica exists. Also, my SQL Server solution could face challenges if the data set or sources are larger or more complex than mine. We have 3 workable options here so far!
– Andrew Glenn
Nov 16 '18 at 17:34
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326856%2fturning-records-by-date-range-into-records-by-day-month-using-sql-server-or-vert%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I believe I've figured it out! :) I am using the following code to create a final table with one record per user per active day. I will then count these by day or month in Tableau. Please, see below.
– Andrew Glenn
Nov 16 '18 at 0:54