Categorize website visitors starting from the first occasion, based on if condition
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
Could you please help me with sql statement, preferreby it should work in big query. I have 3 columns userid, date, hostname. I need to create additional column - client_type on the following condition: when userid first time comes to hostname = "online-store.com" then from this date on client_type for this particular userid will be always "current_client" else "visitor".
For example, in the image (link attached) we have userid = 1 and 4 who had become "current client". User 4 was just a visitor, but after visiting hostname = "online-store.com" he will be always classified as "current client".enter image description here
google-bigquery intervals between dateadd
|
show 1 more comment
Could you please help me with sql statement, preferreby it should work in big query. I have 3 columns userid, date, hostname. I need to create additional column - client_type on the following condition: when userid first time comes to hostname = "online-store.com" then from this date on client_type for this particular userid will be always "current_client" else "visitor".
For example, in the image (link attached) we have userid = 1 and 4 who had become "current client". User 4 was just a visitor, but after visiting hostname = "online-store.com" he will be always classified as "current client".enter image description here
google-bigquery intervals between dateadd
Please edit your question to show a Minimal, Complete, and Verifiable example of the code and most importantly data that you are having problems with, then we can try to help with the your problem. You can also read How to Ask.
– Mikhail Berlyant
Nov 21 '18 at 16:14
take a closer look especially to that part -Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire code! ..., it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines: ...
– Mikhail Berlyant
Nov 21 '18 at 16:16
Mikhail, thanks a lot for advice, I have rewritten my question and added a picture. Also my question has been modified a bit.
– Andrey
Nov 22 '18 at 8:03
see the answer. please in your next/new questions - avoid using images and rather provide data examples as plain text so we can use it while helping you :o)
– Mikhail Berlyant
Nov 22 '18 at 20:20
ok, =) understand
– Andrey
Nov 23 '18 at 8:42
|
show 1 more comment
Could you please help me with sql statement, preferreby it should work in big query. I have 3 columns userid, date, hostname. I need to create additional column - client_type on the following condition: when userid first time comes to hostname = "online-store.com" then from this date on client_type for this particular userid will be always "current_client" else "visitor".
For example, in the image (link attached) we have userid = 1 and 4 who had become "current client". User 4 was just a visitor, but after visiting hostname = "online-store.com" he will be always classified as "current client".enter image description here
google-bigquery intervals between dateadd
Could you please help me with sql statement, preferreby it should work in big query. I have 3 columns userid, date, hostname. I need to create additional column - client_type on the following condition: when userid first time comes to hostname = "online-store.com" then from this date on client_type for this particular userid will be always "current_client" else "visitor".
For example, in the image (link attached) we have userid = 1 and 4 who had become "current client". User 4 was just a visitor, but after visiting hostname = "online-store.com" he will be always classified as "current client".enter image description here
google-bigquery intervals between dateadd
google-bigquery intervals between dateadd
edited Nov 22 '18 at 8:26
Andrey
asked Nov 18 '18 at 18:39
AndreyAndrey
12
12
Please edit your question to show a Minimal, Complete, and Verifiable example of the code and most importantly data that you are having problems with, then we can try to help with the your problem. You can also read How to Ask.
– Mikhail Berlyant
Nov 21 '18 at 16:14
take a closer look especially to that part -Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire code! ..., it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines: ...
– Mikhail Berlyant
Nov 21 '18 at 16:16
Mikhail, thanks a lot for advice, I have rewritten my question and added a picture. Also my question has been modified a bit.
– Andrey
Nov 22 '18 at 8:03
see the answer. please in your next/new questions - avoid using images and rather provide data examples as plain text so we can use it while helping you :o)
– Mikhail Berlyant
Nov 22 '18 at 20:20
ok, =) understand
– Andrey
Nov 23 '18 at 8:42
|
show 1 more comment
Please edit your question to show a Minimal, Complete, and Verifiable example of the code and most importantly data that you are having problems with, then we can try to help with the your problem. You can also read How to Ask.
– Mikhail Berlyant
Nov 21 '18 at 16:14
take a closer look especially to that part -Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire code! ..., it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines: ...
– Mikhail Berlyant
Nov 21 '18 at 16:16
Mikhail, thanks a lot for advice, I have rewritten my question and added a picture. Also my question has been modified a bit.
– Andrey
Nov 22 '18 at 8:03
see the answer. please in your next/new questions - avoid using images and rather provide data examples as plain text so we can use it while helping you :o)
– Mikhail Berlyant
Nov 22 '18 at 20:20
ok, =) understand
– Andrey
Nov 23 '18 at 8:42
Please edit your question to show a Minimal, Complete, and Verifiable example of the code and most importantly data that you are having problems with, then we can try to help with the your problem. You can also read How to Ask.
– Mikhail Berlyant
Nov 21 '18 at 16:14
Please edit your question to show a Minimal, Complete, and Verifiable example of the code and most importantly data that you are having problems with, then we can try to help with the your problem. You can also read How to Ask.
– Mikhail Berlyant
Nov 21 '18 at 16:14
take a closer look especially to that part -
Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire code! ..., it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines: ...
– Mikhail Berlyant
Nov 21 '18 at 16:16
take a closer look especially to that part -
Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire code! ..., it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines: ...
– Mikhail Berlyant
Nov 21 '18 at 16:16
Mikhail, thanks a lot for advice, I have rewritten my question and added a picture. Also my question has been modified a bit.
– Andrey
Nov 22 '18 at 8:03
Mikhail, thanks a lot for advice, I have rewritten my question and added a picture. Also my question has been modified a bit.
– Andrey
Nov 22 '18 at 8:03
see the answer. please in your next/new questions - avoid using images and rather provide data examples as plain text so we can use it while helping you :o)
– Mikhail Berlyant
Nov 22 '18 at 20:20
see the answer. please in your next/new questions - avoid using images and rather provide data examples as plain text so we can use it while helping you :o)
– Mikhail Berlyant
Nov 22 '18 at 20:20
ok, =) understand
– Andrey
Nov 23 '18 at 8:42
ok, =) understand
– Andrey
Nov 23 '18 at 8:42
|
show 1 more comment
2 Answers
2
active
oldest
votes
Below is for BigQuery Standard SQL
#standardSQL
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
You can test, play with above using dummy data you provided in your question
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 userid, DATE '2018-02-01' date, 'online-store.com' hostname UNION ALL
SELECT 2, '2018-02-01', 'other' UNION ALL
SELECT 3, '2018-02-01', 'other' UNION ALL
SELECT 4, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-04-07', 'other' UNION ALL
SELECT 4, '2018-04-08', 'online-store.com' UNION ALL
SELECT 5, '2018-04-08', 'other' UNION ALL
SELECT 6, '2018-04-08', 'other' UNION ALL
SELECT 4, '2018-04-08', 'other' UNION ALL
SELECT 8, '2018-04-08', 'other' UNION ALL
SELECT 1, '2018-07-07', 'other' UNION ALL
SELECT 1, '2018-11-22', 'online-store.com'
)
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
ORDER BY date
with result
Row userid date hostname client_type
1 1 2018-02-01 online-store.com current_client
2 1 2018-02-01 other current_client
3 2 2018-02-01 other visitor
4 3 2018-02-01 other visitor
5 4 2018-02-01 other visitor
6 1 2018-04-07 other current_client
7 4 2018-04-08 online-store.com current_client
8 4 2018-04-08 other current_client
9 5 2018-04-08 other visitor
10 6 2018-04-08 other visitor
11 8 2018-04-08 other visitor
12 1 2018-07-07 other current_client
13 1 2018-11-22 online-store.com current_client
add a comment |
This should be good:
#standardSQL
with userdates as (
select userid, hostname, min(date) as mindate from `dataset.table` where hostname = 'online-store.com' group by userid, hostname
)
select u.userid, u.date, u.hostname, case when u.date >= ud.mindate then 'current_user' else 'visitor' end as client_type
from `dataset.table` u
left outer join userdates ud on u.userid = ud.userid
order by 1, 2
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%2f53364262%2fcategorize-website-visitors-starting-from-the-first-occasion-based-on-if-condit%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Below is for BigQuery Standard SQL
#standardSQL
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
You can test, play with above using dummy data you provided in your question
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 userid, DATE '2018-02-01' date, 'online-store.com' hostname UNION ALL
SELECT 2, '2018-02-01', 'other' UNION ALL
SELECT 3, '2018-02-01', 'other' UNION ALL
SELECT 4, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-04-07', 'other' UNION ALL
SELECT 4, '2018-04-08', 'online-store.com' UNION ALL
SELECT 5, '2018-04-08', 'other' UNION ALL
SELECT 6, '2018-04-08', 'other' UNION ALL
SELECT 4, '2018-04-08', 'other' UNION ALL
SELECT 8, '2018-04-08', 'other' UNION ALL
SELECT 1, '2018-07-07', 'other' UNION ALL
SELECT 1, '2018-11-22', 'online-store.com'
)
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
ORDER BY date
with result
Row userid date hostname client_type
1 1 2018-02-01 online-store.com current_client
2 1 2018-02-01 other current_client
3 2 2018-02-01 other visitor
4 3 2018-02-01 other visitor
5 4 2018-02-01 other visitor
6 1 2018-04-07 other current_client
7 4 2018-04-08 online-store.com current_client
8 4 2018-04-08 other current_client
9 5 2018-04-08 other visitor
10 6 2018-04-08 other visitor
11 8 2018-04-08 other visitor
12 1 2018-07-07 other current_client
13 1 2018-11-22 online-store.com current_client
add a comment |
Below is for BigQuery Standard SQL
#standardSQL
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
You can test, play with above using dummy data you provided in your question
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 userid, DATE '2018-02-01' date, 'online-store.com' hostname UNION ALL
SELECT 2, '2018-02-01', 'other' UNION ALL
SELECT 3, '2018-02-01', 'other' UNION ALL
SELECT 4, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-04-07', 'other' UNION ALL
SELECT 4, '2018-04-08', 'online-store.com' UNION ALL
SELECT 5, '2018-04-08', 'other' UNION ALL
SELECT 6, '2018-04-08', 'other' UNION ALL
SELECT 4, '2018-04-08', 'other' UNION ALL
SELECT 8, '2018-04-08', 'other' UNION ALL
SELECT 1, '2018-07-07', 'other' UNION ALL
SELECT 1, '2018-11-22', 'online-store.com'
)
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
ORDER BY date
with result
Row userid date hostname client_type
1 1 2018-02-01 online-store.com current_client
2 1 2018-02-01 other current_client
3 2 2018-02-01 other visitor
4 3 2018-02-01 other visitor
5 4 2018-02-01 other visitor
6 1 2018-04-07 other current_client
7 4 2018-04-08 online-store.com current_client
8 4 2018-04-08 other current_client
9 5 2018-04-08 other visitor
10 6 2018-04-08 other visitor
11 8 2018-04-08 other visitor
12 1 2018-07-07 other current_client
13 1 2018-11-22 online-store.com current_client
add a comment |
Below is for BigQuery Standard SQL
#standardSQL
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
You can test, play with above using dummy data you provided in your question
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 userid, DATE '2018-02-01' date, 'online-store.com' hostname UNION ALL
SELECT 2, '2018-02-01', 'other' UNION ALL
SELECT 3, '2018-02-01', 'other' UNION ALL
SELECT 4, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-04-07', 'other' UNION ALL
SELECT 4, '2018-04-08', 'online-store.com' UNION ALL
SELECT 5, '2018-04-08', 'other' UNION ALL
SELECT 6, '2018-04-08', 'other' UNION ALL
SELECT 4, '2018-04-08', 'other' UNION ALL
SELECT 8, '2018-04-08', 'other' UNION ALL
SELECT 1, '2018-07-07', 'other' UNION ALL
SELECT 1, '2018-11-22', 'online-store.com'
)
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
ORDER BY date
with result
Row userid date hostname client_type
1 1 2018-02-01 online-store.com current_client
2 1 2018-02-01 other current_client
3 2 2018-02-01 other visitor
4 3 2018-02-01 other visitor
5 4 2018-02-01 other visitor
6 1 2018-04-07 other current_client
7 4 2018-04-08 online-store.com current_client
8 4 2018-04-08 other current_client
9 5 2018-04-08 other visitor
10 6 2018-04-08 other visitor
11 8 2018-04-08 other visitor
12 1 2018-07-07 other current_client
13 1 2018-11-22 online-store.com current_client
Below is for BigQuery Standard SQL
#standardSQL
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
You can test, play with above using dummy data you provided in your question
#standardSQL
WITH `project.dataset.table` AS (
SELECT 1 userid, DATE '2018-02-01' date, 'online-store.com' hostname UNION ALL
SELECT 2, '2018-02-01', 'other' UNION ALL
SELECT 3, '2018-02-01', 'other' UNION ALL
SELECT 4, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-02-01', 'other' UNION ALL
SELECT 1, '2018-04-07', 'other' UNION ALL
SELECT 4, '2018-04-08', 'online-store.com' UNION ALL
SELECT 5, '2018-04-08', 'other' UNION ALL
SELECT 6, '2018-04-08', 'other' UNION ALL
SELECT 4, '2018-04-08', 'other' UNION ALL
SELECT 8, '2018-04-08', 'other' UNION ALL
SELECT 1, '2018-07-07', 'other' UNION ALL
SELECT 1, '2018-11-22', 'online-store.com'
)
SELECT
userid, date, hostname,
IF(0 = COUNTIF(hostname = 'online-store.com') OVER(
PARTITION BY userid ORDER BY date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
), 'visitor', 'current_client') client_type
FROM `project.dataset.table`
ORDER BY date
with result
Row userid date hostname client_type
1 1 2018-02-01 online-store.com current_client
2 1 2018-02-01 other current_client
3 2 2018-02-01 other visitor
4 3 2018-02-01 other visitor
5 4 2018-02-01 other visitor
6 1 2018-04-07 other current_client
7 4 2018-04-08 online-store.com current_client
8 4 2018-04-08 other current_client
9 5 2018-04-08 other visitor
10 6 2018-04-08 other visitor
11 8 2018-04-08 other visitor
12 1 2018-07-07 other current_client
13 1 2018-11-22 online-store.com current_client
answered Nov 22 '18 at 20:19
Mikhail BerlyantMikhail Berlyant
63.3k43874
63.3k43874
add a comment |
add a comment |
This should be good:
#standardSQL
with userdates as (
select userid, hostname, min(date) as mindate from `dataset.table` where hostname = 'online-store.com' group by userid, hostname
)
select u.userid, u.date, u.hostname, case when u.date >= ud.mindate then 'current_user' else 'visitor' end as client_type
from `dataset.table` u
left outer join userdates ud on u.userid = ud.userid
order by 1, 2
add a comment |
This should be good:
#standardSQL
with userdates as (
select userid, hostname, min(date) as mindate from `dataset.table` where hostname = 'online-store.com' group by userid, hostname
)
select u.userid, u.date, u.hostname, case when u.date >= ud.mindate then 'current_user' else 'visitor' end as client_type
from `dataset.table` u
left outer join userdates ud on u.userid = ud.userid
order by 1, 2
add a comment |
This should be good:
#standardSQL
with userdates as (
select userid, hostname, min(date) as mindate from `dataset.table` where hostname = 'online-store.com' group by userid, hostname
)
select u.userid, u.date, u.hostname, case when u.date >= ud.mindate then 'current_user' else 'visitor' end as client_type
from `dataset.table` u
left outer join userdates ud on u.userid = ud.userid
order by 1, 2
This should be good:
#standardSQL
with userdates as (
select userid, hostname, min(date) as mindate from `dataset.table` where hostname = 'online-store.com' group by userid, hostname
)
select u.userid, u.date, u.hostname, case when u.date >= ud.mindate then 'current_user' else 'visitor' end as client_type
from `dataset.table` u
left outer join userdates ud on u.userid = ud.userid
order by 1, 2
answered Nov 22 '18 at 23:33
khankhan
2,17993153
2,17993153
add a comment |
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%2f53364262%2fcategorize-website-visitors-starting-from-the-first-occasion-based-on-if-condit%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
Please edit your question to show a Minimal, Complete, and Verifiable example of the code and most importantly data that you are having problems with, then we can try to help with the your problem. You can also read How to Ask.
– Mikhail Berlyant
Nov 21 '18 at 16:14
take a closer look especially to that part -
Not all questions benefit from including code. But if your problem is with code you've written, you should include some. But don't just copy in your entire code! ..., it likely includes a lot of irrelevant details that readers will need to ignore when trying to reproduce the problem. Here are some guidelines: ...
– Mikhail Berlyant
Nov 21 '18 at 16:16
Mikhail, thanks a lot for advice, I have rewritten my question and added a picture. Also my question has been modified a bit.
– Andrey
Nov 22 '18 at 8:03
see the answer. please in your next/new questions - avoid using images and rather provide data examples as plain text so we can use it while helping you :o)
– Mikhail Berlyant
Nov 22 '18 at 20:20
ok, =) understand
– Andrey
Nov 23 '18 at 8:42