'Power BI : filter on a rank

I have calculated ranked using this formula which worked perfectly well : RANK = RANKX(ALL(td_store[LIB_MAG]), CALCULATE(SUM(tf_market_share_by_store_nomcenclature[marche]),ALLEXCEPT(td_store,td_store[LIB_MAG]))) enter image description here

I have a slicer on the LIB_MAG which filter correctly my table : enter image description here

However I don't want to see only the selected mag but the five previous and the last following mag, basing on the rank (in this exemple, the rank 121 to 131) like this : enter image description here

Note that the rank is filtered on the LIB_RAY selected on an other slicer, so I did not succeed to pass by temporary tables ...

I tried this but it doesn't work because the RANK is a measure, not a column (it's not possible to use it in ALLEXCEPT) :

enter image description here

I tried this too but I don't succeed to extract the rank of the selected mag (because it's a measure again)

enter image description here

Have you got ideas to do this ?



Sources

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

Source: Stack Overflow

Solution Source