Skip to content

Instantly share code, notes, and snippets.

@chroder
Created May 14, 2018 12:58
Show Gist options
  • Save chroder/70bde2256fe3d86fb6ca8141d62319da to your computer and use it in GitHub Desktop.
Save chroder/70bde2256fe3d86fb6ca8141d62319da to your computer and use it in GitHub Desktop.
SELECT
AVG(tickets.custom_data[rate_responsiveness])*5 AS 'Responsiveness',
'Responsiveness: {{formatNumber (math value "/" 5) minimumFractionDigits=0 maximumFractionDigits=1}} out of 5' as 'tooltip_text_template'
FROM tickets
WHERE
tickets.custom_data[rate_responsiveness].value <> NULL
AND tickets.custom_data[external_lawyer] <> NULL
GROUP BY DPQL_HIERARCHY(tickets.custom_data[external_lawyer], 1) AS 'Firm'
LAYER WITH
SELECT
AVG(tickets.custom_data[rate_commerciality])*5 AS 'Commerciality',
'Commerciality: {{formatNumber (math 0_value "/" 5) minimumFractionDigits=0 maximumFractionDigits=1}} out of 5' as 'tooltip_text_template'
FROM tickets
WHERE
tickets.custom_data[rate_commerciality].value <> NULL
AND tickets.custom_data[external_lawyer] <> NULL
GROUP BY DPQL_HIERARCHY(tickets.custom_data[external_lawyer], 1) AS 'Firm'
LAYER WITH
SELECT
AVG(tickets.custom_data[rate_value])*5 AS 'Value',
'Value: {{formatNumber (math 1_value "/" 5) minimumFractionDigits=0 maximumFractionDigits=1}} out of 5' as 'tooltip_text_template'
FROM tickets
WHERE
tickets.custom_data[rate_value].value <> NULL
AND tickets.custom_data[external_lawyer] <> NULL
GROUP BY DPQL_HIERARCHY(tickets.custom_data[external_lawyer], 1) AS 'Firm'
LAYER WITH
SELECT
AVG(tickets.custom_data[rate_friendliness])*5 AS 'Friendliness',
'Friendliness: {{formatNumber (math 2_value "/" 5) minimumFractionDigits=0 maximumFractionDigits=1}} out of 5' as 'tooltip_text_template'
FROM tickets
WHERE
tickets.custom_data[rate_friendliness].value <> NULL
AND tickets.custom_data[external_lawyer] <> NULL
GROUP BY DPQL_HIERARCHY(tickets.custom_data[external_lawyer], 1) AS 'Firm'
@chroder
Copy link
Author

chroder commented May 14, 2018

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment