Using custom SQL metric to get a percentage #29238
Replies: 1 comment
-
The chart query shows the metric is limited to 5000 which explains the difference. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was hoping someone could help and either tell me what i am doing wrong or simply confirm what i am trying is not possible.
I am using the big number chart with the aim to give me a percentage number.
I have created a customer SQL metric which is:
SUM(CASE WHEN receiveddate <= itemduedate AND itemstatus = 'COMPLETE' AND receiveddate IS NOT NULL THEN 1 ELSE 0 END) * 100.0 / SUM(CASE WHEN itemstatus = 'COMPLETE' AND receiveddate IS NOT NULL THEN 1 ELSE 0 END)
The first SUM CASE should give a result of '16008' which i have then multiplied by 100
The second SUM CASE should give a result of '27065'
(This is confirmed by querying the relevant database with the same WHERE clauses present.
So when we do the math on a calculator we get 16008 x 100 / 27065 = 59.14
However the metric returns a result of 39.25
What am i missing here?
If you need any more info then just let me know.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions