How to sort RG with two different Data types


So basically I have one Data type “Posts” and another one “Views”.
Each time user views one post type, new “View” will be made (necessary for statistics), but now I want to sort RG by most views, I’ve been struggling so much with this.
I have a Group with a state, when user clicks on a group then the state will change “Most Viewed” “Recent” etc ( swapping the Data source ), if there is a better way for this also then, my ears are open and I’m up for that also.
Any suggestions?

Data type views has a field which is linked with Post

Hi there, @andero… this suggestion might seem a bit hacky, but if it was me, I would consider having a number field on the Post data type that is a count of the views for a post. Then, when a thing is created in the View data type, simply add 1 to the associated post’s views count field, and you’d be good to go to sort the posts on that field.

Hope this helps.