Many reports and analyses are built around the ranking of dimensions relative to measures, such as the top 10 salespeople based on YTD sales. Ranking measures can also help deliver more clean and intuitive report visualizations as they substitute small integer values for large numbers and decimal places. Ranking measures can be as simple as specifying a column and a measure, or more complex with unique ranking logic applied in distinct filter contexts.
Ranking measures in DAX are implemented via the RANKX() function, which is an iterator like SUMX() and FILTER(). As an iterating function, two required input parameters include a table and the expression to be evaluated for each row of the table. The following two measures rank products based on the Internet Net Sales measure:
Internet Net Sales Product Rank =
RANKX(ALL('Product'[Product Alternate Key]),[Internet Net Sales],,DESC,Skip)
Internet Net Sales Product Rank (All Products) =
VAR ProdRankTable =
ALL('Product'[Product Alternate Key],'Product'[Product Name],'Product'[Product Category
Group],'Product'[Product Category],'Product'[Product Subcategory],'Product'[Product Name])
RETURN
RANKX(ProdRankTable, [Internet Net Sales],,DESC,Skip)
In the Internet Net Sales Product Rank measure, the ALL() function returns a table of the unique product's alternate key values. Since only a single column is referenced by ALL() in this measure, other columns from the Product dimension table are allowed into the filter context. For example, in the following table, the Product Category column impacts the Internet Net Sales Product Rank measure so that the HL-U509-R product is ranked first given that it's the highest selling product in the Accessories category:

The Internet Net Sales Product Rank (All Products) measure, however, ranks the product relative to all other products including products in the Bikes category. The group of columns specified in the ALL() function (the table parameter to RANKX()), defines the set of rows that the ranking expression will be evaluated against.
Internet Net Sales Product Rank = IF(HASONEVALUE('Product'[Product Alternate Key]),
RANKX(ALL('Product'[Product Alternate Key]),[Internet Net Sales],,DESC,Skip),BLANK())
As shown in this example, it's essential to understand the intended ranking logic and it may be necessary to store alternative ranking measures to suit the requirements of different reports and projects.