cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
amilkarigi Regular Visitor
Regular Visitor

RANKX Measure issue

Captura.PNGCaptura1.PNG

 

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)
1 ACCEPTED SOLUTION

Accepted Solutions
Vvelarde Super Contributor
Super Contributor

Re: RANKX Measure issue

@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

 

img.png

 

imgw.png

regards

 

Victor




Lima - Peru
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




12 REPLIES 12
Community Support Team
Community Support Team

Re: RANKX Measure issue

@amilkarigi,

 

You may try to use ALLSELECTED Function.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amilkarigi Regular Visitor
Regular Visitor

Re: RANKX Measure issue

In which measure? Top Clientes?

Super User
Super User

Re: RANKX Measure issue

Hi,

 

My suggestion is to create a seperate RANK measure

 

=RANKX(ALL(Clientes[CompanyName]); [Ventas Total];;DESC)

 

Now in the first visual, drag this measure to the Visual Level filters and apply a criteria there of <=10.

amilkarigi Regular Visitor
Regular Visitor

Re: RANKX Measure issue

It's does nothing Smiley Sad here's a link where you can download the pbix document for better comprehension https://drive.google.com/open?id=1CHv9ejaaboVk7kS-7V0W61GPzb8uS7qs 

Super User
Super User

Re: RANKX Measure issue

Hi,

 

I checked another post as well where you have described the same/similar problem.  Sorry but i cannot help much since the language there is no English.  Also, the link that you have shared in your previous post does not work.

amilkarigi Regular Visitor
Regular Visitor

Re: RANKX Measure issue

Vvelarde Super Contributor
Super Contributor

Re: RANKX Measure issue

@amilkarigi

 

hi, Edit this measure:

 

Mas Vendido =
CALCULATE (
    FIRSTNONBLANK ( TOPN ( 1; ALL ( Productos[ProductName] ); [ProdV]; DESC ); 1 );
    ALL ( Clientes[CompanyName] )
)

img.png

Regards

 

Victor

Lima -Peru




Lima - Peru
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




amilkarigi Regular Visitor
Regular Visitor

Re: RANKX Measure issue

Thanks @Vvelarde but it doesn't work, because if I select 2013 it just give me 3 companies, when it should give me 6, in this order:

Captura.PNGResultlarge.pngExpected result

 

The idea is that the result should be the top 10 companies that have bought my "mas vendido" (top product). In this example the Halter Dress has had 0 sales along with other products, but in 2013 was the top buyed product from this group with almost 91K sales.

Vvelarde Super Contributor
Super Contributor

Re: RANKX Measure issue

@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

 

img.png

 

imgw.png

regards

 

Victor




Lima - Peru
Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Power BI Helps Homeless and Trouble Youth

Power BI Helps Homeless and Trouble Youth

We spoke with Power BI Super User, Greg Deckler, about his charity work

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 126 members 1,402 guests
Please welcome our newest community members: