Hi Team, I have a simple count metric, but when i ...
# gd-beginners
n
Hi Team, I have a simple count metric, but when i go to sort by it is is being sorted as a character, not a number. This also seems to prevent multiple segmentations on the metric. How do I set this up so the count is treated as a number.
y
Hi Nate, Thanks for sending this in, happy to help. Could you kindly provide a bit more context on this? Specifically, I’d like to understand how you are currently sorting your data and what results you are expecting. If possible, please share some screenshots to help illustrate the issue, as well as a direct link to the report so that I can impersonate and take a closer look. This will help me better understand the situation and assist you more effectively.
n
Thanks Yvonne, I would expect this to sort by the customer cound desc, so 2,398, 1450, 1406.... sorting by margin gives the correct order. The error when trying to stack the metric is "Cannot compute total of a non-numeric value.
i
Hello Nate, thank you for your patience as we investigated the issue. The problem stems from Customer Number having null values for both cases: 1. The customer count not descending/ascending like what is expected 2. When try to make a calculation on the value I created a metric with the same value you have shared in the first screenshot and just added if there is null value, swap it with 0 So your metric is: SELECT COUNT( Customer Number {label/customer_number}) My metric is: SELECT IFNULL(COUNT({label/customer.customer_name}), 0) I have created the visualisation here: As you can see the customer count(test4) is showing them in correct order. And for the second screenshot you shared, I replicated and performed sum of all Customer Count(test4 metric) and it worked without an error. To sum it up, when there is a null value in data, it creates all sorts of problems. It is always a good idea to make sure there are no null values. Please let me know if there is anything else I can help you with.
m
Hi @Nate De Winkle , just to follow-up, while the solution provided by @Ismail Karafakioglu above does work, we also consulted the original behavior with our Product Team and confirmed that this is not the intended sorting behavior even if there are NULL values present and we submitted an internal bug report for that. We currently do not have an ETA for the fix, but wanted to let you know that our team has it on their radar now. Thank you for reporting that and please accept an appology for the inconvenience.
Hi Nate, just wanted to give you an update that our engineers have identified the root cause and developed a fix for the sorting issue you experienced. It was already merged and should be released to production in one of the following releases within a couple of days.
i
Hello @Nate De Winkle, I just got confirmation that the fix has been released. Could you please check if the issue is resolved on your end? Thank you.