Group data in different levels

If I have 3 levels of data, like: Country, state and city.
If every row in my table is a city info, for example roads names. If I need group data by city, state and country, for example, compare the number of roads in a city with state. Is there a way to do this?

I’m trying to group by state and when I try to compare city values with state I got this error:

like:
calculated_filed1
count({roads_names}, [{state}])

calculated_field2
count({roads_names}, [{country}])

calculated_filed1 > calculated_field2
Once I try to compare 2 aggregated the calculation field works, but then it not show value:

image

Hi @igfasouza,
When dealing with errors like this, like mismatched aggregations, you’ll have to incorporate the usage of Level-Aware Calculations (LAC).
Looking at your calculated fields, I would suggest that you explore the CountOver function as opposed to the regular ‘count’.

Let me know if this works for your case or if you have additional questions.

Hi @igfasouza,
Following back up here as it’s been awhile since we last heard from you; did you have any additional questions regarding your post?

If we do not hear back within the next 3 business days, I’ll close out this topic.

Thank you!

Hi @igfasouza,
Since we have not heard back, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community and link this discussion for relevant information if needed.

Thank you!