I’ve built a workshop dashboard with multiple metrics, bar charts, and a timeline view. I now need to create a more complex metric using aggregation and filtering.
What I’m Trying to Accomplish
I have a feedback object set in my ontology with columns including sentiment and specialty. I want to create a metric that shows which specialty has the most negative sentiment.
My Approach So Far
I believe I need to:
Group by the specialty field
Filter for only “Negative” values in the sentiment field
Count occurrences for each specialty
Display the specialty with the highest count
My Questions
What’s the best way to implement this logic in Foundry to create this metric?
Is there a way to do this directly in the dashboard builder or do I need to use a different approach?
Are there any specific functions or techniques that would make this easier?
Can this be accomplished using Workshop’s native functionality or do I need to use OntologyQuery?
Hi @sateesh your requirement might not be straight forward but let’s see what we can work out together.
a simple way to use built-in would be to work with pivot tables. For that it might help to have an int/ bool flag of the sentiment that you can easily aggregate (sum ). The column grouping is your speciality. You can configure pivot tables to sort dsc by value. However the output will look table-ish and you could not show only the top 1. but it would allow you to quickly check if your metric makes sense. And pivot tables have other benefits. You could e.g. use the row grouping to further breakdown the specialty into sub-categories or „over time“ if that exists in your feedback object type
If you want to put the specialty as a string on a metric card you might have to go the route of a typescript function. I unfortunately can‘t think of a built-in way to use variable transformations to „do the groupby-count and take index 1“. In ts instead you can do all your magic and just output the string. typescript might require a bit learning depending on your experience. But every GPT will be able to give you some example snippets for this.
Last Option I can think of is to embed a small quiver only having the metric as a dashboard. In the quiver flow you can actually do a lot of „advanced“ calculations that would require ts directly in workshop. And the integration works like a charm
Hope that helps. Let me know if you need more help