Forum Discussion

amilkarigi's avatar
amilkarigi
Helper I
8 years ago
Solved

RANKX Measure issue

 

The problem is that I have a top 10 measure with rankx:

Top Clientes = 
VAR
    Prod = [Mas Vendido]
VAR
    Cliente = VALUES(Clientes[CompanyName])
RETURN
    CALCULATE([Ventas Total];
        FILTER(Cliente;
            RANKX(ALL(Clientes[CompanyName]); [Ventas Total];;DESC) <= 10); Productos[ProductName] = Prod)

And when I select an specific year it should only show me the top 10 customers who bought the top product, in this case Okkaba Skin Jackets, but if you see in the second image only 3 customers buy it that year, therefore in the table of the first image should only be 3 customers not 10, how can I fix this?

PSD: Here's the code for "Mas Vendido" if you need it:

Mas Vendido = FIRSTNONBLANK(TOPN(1; ALL(Productos[ProductName]);[Ventas Total];DESC); 1)
  • Vvelarde's avatar
    Vvelarde
    8 years ago

    amilkarigi

     

    HI, I try to simplify this:

     

    Top Clientesrl =
    VAR Prod = [Mas Vendido]
    RETURN
        CALCULATE ( [Ventas Total]; Ordenes[ProductName] = Prod )

    in the visual level filter

     

     

    regards

     

    Victor

12 Replies