# Table from grouping an association by value

I have an Association with lots of key-value pairs. The values are integer numbers from a finite set. I'd like to group all the keys that have a certain number as value, and make a table with values (numbers) on top row (one per column) and each key set under each corresponding value.

I tried with GroupBy, with no success.

Edit Example:

<|key1->2, key2->4, key3->4, key4->2, key5->7, key6->4|>


Output: a table like this:

|  2     |   4     |  7      |
| key1   | key2    | key5    |
| key4   | key3    |         |
|        | key6    |         |


GroupBy[a, Identity, Keys] // Dataset