Search code examples
filterpowerbidaxrankmeasure

Filter a RANKX measure


I have a table in Power BI like that:

Year    Company Country Revenue
2019    XXX     Brazil  1029029
2018    YYY     France  1029100
2019    ZZZ     Brazil  1929201
2017    XXX     Brazil  8291020

I cooked the following measure:

RANKX(ALL(
'Data'[Company];
'Data'[Country]);
CALCULATE(SUM('Data'[Revenue]);'Data'[Year]=2019))

I want to build a table visual on Power BI which consider only company 'XXX' rank position for every country.

If I drop this measure on a Power BI Table as a column, I need to filter this Table to consider only company 'XXX'. I want to know if it's possible to consider this filter for company in my measure.


Solution

  • You could change your measure and filter your visual by XXX. This is your measure at the moment, with and without the filter. Here you just dont display the filtered rows and the result is the same:

    enter image description here

    enter image description here

    If you change your measure like this you get the right result with the filter, you get different results for the rank:

    enter image description here

    enter image description here

    You can put the XXX filter also in your table visual and not directly on the report. This way it is more hidden.