Calculating the highest cost in a category

Hi. I am working on a dashboard and want to give users a tile that shows a category with the highest value. To be a bit more clear, users log expenses and tie them to a set of categories (stored as an option set) and I’d like this dashboard tile to display the name of the category where the majority of expenses are going. This would mean totalling up each item’s cost, sorting by category and identifying which category has the highest number. My math and programming skills are not good enough for this.

Does anyone have an idea as to how I might go about this? Thanks.

Search for your expenses and group them:

Sort so the largest sum amount is first in the list:

Grab the first item and show the Category’s Name :slightly_smiling_face:

This is all in a text element, but you could put it on a RG and instead of showing the first item, you can show the list ranked by their sums (or maybe even stick it on a chart)

Also I made Category as a datatype cause I figured users would want to add their own Categories, but it should work the same as an option set (but Category’s Name might be Display instead).

2 Likes

I was making an example at the same time, and it is literally the same as Tyler’s, but with the option set instead. So, great minds… or something like that.

2 Likes

I started typing it out theoretically but I have no idea how grouping works so I had to test it first :flushed: :rofl:

2 Likes

I essentially have to relearn grouping every time I use it.

3 Likes

Wow! That worked like a charm! You guys are brilliant! Thank you!

2 Likes