DAX RANKX function can be applied to two-dimensional columns using the CROSSJOIN function. The CROSSJOIN function combines two or more tables by creating all possible combinations of rows.
Here is an example of how to use DAX RANKX with two-dimensional columns:
Assume we have two tables, Sales and Products, and we want to rank the sales by product category and year.
Total Sales = SUM(Sales[Amount])
YearTable = DISTINCT(Sales[Year])
CrossJoinTable = CROSSJOIN(Products, YearTable)
SalesByCategoryYear =
CALCULATE(
[Total Sales],
CROSSFILTER(Sales[ProductId], Products[ProductId], Both),
CROSSFILTER(Sales[Year], YearTable[Year], Both)
)
Rank = RANKX(CrossJoinTable, [SalesByCategoryYear])
This will give you a rank for each category and year combination in the CrossJoinTable. You can then use this rank in visualizations or to filter the data.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-29 23:12:06 +0000
Seen: 13 times
Last updated: May 29 '23