Oh, maybe there is an easier way to achieve that. According to release notes they've added ability to choose Top or bottom N categories in bar chart. To edit, open the kebab menu for the categorical axis dimension and set the number under Default number of categories:

szymon_dybczak_1-1762522775404.png

 

 

szymon_dybczak_0-1762522713482.png