Allan Talver
04/29/2022, 6:16 AMSELECT COUNT (
Date (NPS Date),
Records of NPS History
)
WHERE Has_Responded = Yes
This finds me NPS surveys that have been sent to the client and received a response. The dataset also has the client email attribute attached. So I would like to find the latest NPS survey that has been sent to the client and for which a a response has been received.Jan Rehanek
04/29/2022, 7:22 AMAllan Talver
05/02/2022, 9:54 AMSELECT MAX (
SELECT (
1000000 * MAX(Day of Month (NPS Date)) +
10000 * MAX(Month (NPS Date)) +
MAX(Year (NPS Date)) -
1900 + 1900
)
BY Records of NPS History
)
WHERE
Is_Responded = Yes
AND (
SELECT COUNT (
Date (NPS Date),
Records of NPS History
)
WHERE Is_Responded = No
WITH PARENT FILTER
) > 0
WITH PARENT FILTER EXCEPT Date (NPS Date)
What I want to achieve is a metric that comes back with the date of the most recent survey that has received a response for a client who has an unanswered survey within the filtered time period. For instance, the user selects time period ‘last month’ and sees, which clients have not yet responded the survey and when was the last time we sent a survey and did receive a response from the same person.
The problem with that metric currently is that the “WITH PARENT FILTER EXCEPT Date (NPS Date)” section doesn’t appear to have any effect. So it only shows a value if that previously unanswered survey happens to fall into the same time period that is selected in the filter. It should show a result even if the previous survey was sent in the past time period.Allan Talver
05/02/2022, 9:59 AMSELECT MAX (
SELECT (
1000000 * MAX(Day of Month (NPS Date)) +
10000 * MAX(Month (NPS Date)) +
MAX(Year (NPS Date)) -
1900 + 1900
)
BY Records of NPS History
)
WHERE Is_Responded = No
Allan Talver
05/02/2022, 11:52 AMJan Rehanek
05/03/2022, 6:29 AMAllan Talver
05/03/2022, 9:35 AMSELECT MAX (
SELECT (
10000 * MAX(Year (Due Date)))
+ (100 * MAX(Month (Due Date)))
+ (MAX(Day of Month (Due Date)))
BY Records of NPS History
)
WHERE (
Is_Responded = Yes
AND IFNULL (
(
SELECT COUNT (Date (Worked Date), Records of NPS History)
WHERE Is_Responded = No
WITH PF
), 0
) > 0
)
WITH PF EXCEPT Date (Worked Date)
The overall goal is still the same as I explained before. This metric should show the expiry date (Due Date) of latest answered survey (regardless of the time period of that survey/answer) for a client contact IF there is an unanswered survey in the filtered time period. Filtering happens on “Worked Date” which is used to record the date when the survey was sent.
See the screenshot for illustration. The metric definition is for “Prev. Expiry”. “Prev. Sent” is the sending date of that previous survey whose expiration date is shown in “Prev. Expiry”. Possible “Prev Expiry” and “Prev Sent” values should not be affected, by the report/dashboard filter on the “Worked Date” column, but there should only be a value when there is an unanswered survey in the selected time period (if there is a value in the “New Sent” column).Allan Talver
05/03/2022, 9:37 AMAllan Talver
05/03/2022, 9:41 AMAND IFNULL (
(
SELECT COUNT (Date (Worked Date), Records of NPS History)
WHERE Is_Responded = No
WITH PF
), 0
) > 0
So that if there are 0 records in the time period with “Is_Responded” attribute value “No” in the time period set in dashboard filter, then the row should not be even visible.Allan Talver
05/03/2022, 9:42 AMJoseph Heun
05/03/2022, 2:18 PMMaria Nawrocik
05/05/2022, 8:10 AMJoseph Heun
05/05/2022, 8:12 AM