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

RANKX Issue

Hi there Robot Very Happy

I need help with this code:

Top Clients = 
VAR
    Prod = [Top product]
VAR
    Client = VALUES(Clients[CompanyName])
RETURN
    CALCULATE([Total Sales];
        FILTER(Client;
            RANKX(ALL(Clients[CompanyName]); Total Sales];;DESC) <= 10); Orders[ProductName] = Prod)

I need to put in a table the companies thtat have bought my Top Product Prod, but the reuslt is not coherent.

Captura.PNGwhat returnsCaptura1.PNGWhat should return
It ruturns 10 clients, when it should only return 6 and the #1 company should be Warp AG no Sunny Ski Store and I don't know how to solve this.

PSD:
Top Product measure

Top Product = FIRSTNONBLANK(TOPN(1; ALL(Products[ProductName]); [ProdV];DESC); 1)

ProdV measure

 

ProdV = 
VAR
    Actual = [ActualSales]
VAR
    Previous = [PreviousSales]
RETURN
    IF(Actual > 0 && Previous = 0; CALCULATE([Total Sales]))

Actual measure is the actual year, Previous is the previous year and Total Sales is just what it says.
ProdV measure's goal is to return me the total sales of products were not sold the previous year but sold in the actual year.

2 REPLIES 2
Highlighted
v-huizhn-msft Super Contributor
Super Contributor

Re: RANKX Issue

Hi @amilkarigi,

It's hard to troubleshoot your issue without sample table, please share your .pbix file for further analysis.

Best Regards,
Angelia

amilkarigi Regular Visitor
Regular Visitor

Re: RANKX Issue

Here's the link, I'll be in touch for whatever question you have, Thanks for everything

https://drive.google.com/file/d/1CHv9ejaaboVk7kS-7V0W61GPzb8uS7qs/view?usp=sharing 

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and 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.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 164 members 2,241 guests
Please welcome our newest community members: