Forum Discussion

psiripun's avatar
psiripun
Frequent Visitor
6 years ago
Solved

Top Customers using RANKX and SUMX

Hi all, I'm trying to understand why my formula isn't working the way I expect it to... I'm still fairly new to DAX so any help would be greatly appreciated! 

 

I'm trying to rank the customers according to their sales value.. but as you can see, the ranking isn't giving me the correct result. 

 

 

 

Rank_Customer = RANKX(ALL(Customer[CustomerName]), SUMX(RELATEDTABLE('DataTable'), DataTable[Sales_YTD]))
Sales_YTD = TOTALYTD([Total_Sales], Period[Date])
Total_Sales = CALCULATE(SUM(DataTable[Value]), FILTER(DataTable, DataTable[Type]="SALES"))

 

 

Could someone help point out what I'm doing wrong please? Thank you! 

2 Replies