Forum Discussion
TopN
Here it is a measure to produce the sales of top 2 products. Why is the TopN the products are arranged based on Product[Name]?? Shouldn't it be sorted based on the measure [total]. What is the correct way if i want topN sales in each continent?
3 Replies
- bhanu_gautamSuper User
Cyriackpazhe , RankProduct = RANKX(
ALLSELECTED(Product[Name]),
[TotalSales],
,
DESC,
DENSE
)It must be using measure like this so it is sorting on the basis of Total Sales but listing it product name wise
- CyriackpazheHelper III
In the topN , he he had written calculate( [total], TopN( 2, products, [total],ASC)) would the result be correct? If i sort by Product[Name], i won't be getting the products with the top sales right
- bhanu_gautamSuper User
Cyriackpazhe it sorts the products in ascending order based on the [total] measure, which means it will return the products with the lowest sales instead of the highest. For highest use Desc.