Hi all, I'm trying to create this NPS score metric...
# gd-beginners
z
Hi all, I'm trying to create this NPS score metric but it's showing me this error (traceID:
cd99ef9e84ba15319b114aa5b3a3aa0a
). I'm not exactly sure what it means but i'm currently defining the NPS score metric as
SELECT (COUNT({metric/promoter_count}) - COUNT({metric/detractor_count})) / COUNT({label/csat_nps.record_id}) * 100
which didn't seem to throw any error when i saved it, so i'm not sure about whats causing that error.
Also i noted from the error message 'Cannot convert object = 'ObjectIdentifier(id=promoter_count)... I'm assuming its referring to another metric that is currently defined as
SELECT IF {label/promoter_tier} = "Promoter" THEN  COUNT({label/csat_nps.record_id}) END
m
Hi Zea, as the errors states there:
Copy code
Cannot convert object='ObjectIdentifier (id=promoter_count,space=ed0d200bab424b55a428dadf1b9c2f16, type=METRIC)' to an attribute.
So it seems the logic in
SELECT IF {label/promoter_tier} = "Promoter" THEN COUNT({label/csat_nps.record_id}) END
may not be correctly handling aggregation and filtering. I think by simplifying your metric it should help here:
SELECT COUNT({label/csat_nps.record_id}) WHERE {label/promoter_tier} = "Promoter"
Can you give this a go and let us know if this helps?
z
Hi Michael, thank you for the help! I tried simplifying both the
promoter_count
and
detractor_count
metric and running the NPS score metric again. But it's still returning the same error message. This is the traceID if it helps!
a04cd472f882a7d5ff8adac73067c757
👀 1
i
Hi Zea, Could you share with me the name or link to the secondary metric, please? I've tried to rebuild your original NPS Score metric a bit and saved it as "GD Test" under your workspace:
Copy code
SELECT SUM({metric/promoter_count}) - SUM ({metric/detractor_count})/COUNT({label/csat_nps.record_id}) * 100
Could you kindly review it, please?
z
Hi Ivana, sorry for the late response! Yes it works now thank you so much!
🙌 1
i
Awesome, very glad to hear so.
z
Hi, sorry i'm encountering another similar issue, this time with another metric defined as:
Copy code
SELECT COUNT({label/csat_nps.record_id}) WHERE {label/overall_rating} IN ("4", "5")
I think its not filtering properly because its returning me the total number of record ID instead. I've tried writing 4 and 5 as a number instead of a string but that shows an error. The data type for the overall_rating attribute is an integer.