Search code examples
powerbidaxdata-analysispowerbi-desktopmeasure

How to remove the filtered items from Rankx function in power bi


I have small table with Product Name and Amount. I am trying to create one rankx function which should ignore the filtered items from calculation. Data looks like below

enter image description here

My Ranks measure :Rank = rankx(ALL('Table'[Product]),CALCULATE(SUM('Table'[Amount])))

But here issue is whenever I put one slicer and un filter one product, rank will skip that product's rank and will show remaining procut's rank

enter image description here

I dont want skip one rank here .Instead it should be like serial number continous. My purpose is to show top N excluding few items with serial number or rank number .In order to exclude items either I will use slicer and filter panel

How to achieve this through measure


Solution

  • You just need to use ALLSELECTED()

    :Rank = rankx(ALLSELECTED('Table'[Product]),CALCULATE(SUM('Table'[Amount])))