'How do I create banded ranks?

I'm very new to Power BI and have a couple questions that will probably be easy to all of you.

I have a table where each row is an attendance and will have a user id, so multiple rows will have the same user id for a returning user (Table example). I have then created another table from that which gives the number of attendances per user (duplicating the table and then grouping it)

I would now like to categorise those users by top 10% of attenders, 10-20% of attenders such that I can create a graph like the one below (with the y axis being number of total attendances). Any help in how to do this would be greatly appreciated.

Image of ideal graph

  1. The original table of each attendance will also have arrival date and departure date (along with the user id). I would like to find the next instant a user attended and if that arrival date is less than 7 days after the previous departure date, flag it (mark as Y). Once again, I do not know how to do this is power bi/query.

I've spent a large portion of the day trying to figure this out and going at it from a power bi and power query approach and being confused on both. Happy to provide anymore clarifying information anyone would need :)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source