Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
amilkarigi
Helper I
Helper I

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

@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

View solution in original post

12 REPLIES 12
Ashish_Mathur
Super User
Super User

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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 

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.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

@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

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:

ResultResultExpected resultExpected 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.

@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

 

Could you please send me that pbix file, because in mine it still shows the same and I still don't know why it persists in showing me companies it shouldn't:

Captura.PNGlarge.png

@amilkarigi

 

ok.

 

link

 

Regards

Victor

Lima - Peru




Lima - Peru

Thanks a lot @Vvelarde, you really helped me. I've been working on that problem for a week and now I finally finished Robot Very Happy

v-chuncz-msft
Community Support
Community Support

@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.

In which measure? Top Clientes?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.