Forum Discussion
Avoid Context When Ranking
- 1 year ago
Understood, thanks for clarifying Anonymous 🙂
If we call the relevant fact table FactTable, you could write something like this:
RANK = IF ( NOT ISEMPTY ( FactTable ), VAR Names = CALCULATETABLE ( SUMMARIZE ( FactTable, D_TEST[NAME] ), ALLSELECTED () ) RETURN RANK ( DENSE, Names ) )This should return a "dense" rank based solely on D_TEST[NAME]. The ranking is relative to the list of NAME values for which the FactTable is nonempty in the ALLSELECTED() context.
It will only return a rank when FactTable is nonempty.
Does this work for you?
Understood, thanks for clarifying Anonymous 🙂
If we call the relevant fact table FactTable, you could write something like this:
RANK =
IF (
NOT ISEMPTY ( FactTable ),
VAR Names =
CALCULATETABLE ( SUMMARIZE ( FactTable, D_TEST[NAME] ), ALLSELECTED () )
RETURN
RANK ( DENSE, Names )
)
This should return a "dense" rank based solely on D_TEST[NAME]. The ranking is relative to the list of NAME values for which the FactTable is nonempty in the ALLSELECTED() context.
It will only return a rank when FactTable is nonempty.
Does this work for you?
I'm glad the formula worked, Thank You !