Forum Discussion
Calculations by Rank
- 7 years ago
Anonymous -
Would the below work for you?
Var = VAR nextRank = Table1[Rank] + 1 VAR differnce = CALCULATE( VALUES(Table1[Value]), FILTER(ALLEXCEPT(Table1,Table1[Type]),Table1[Rank] = nextRank) ) - Table1[Value] RETURN IF( differnce >= 0, differnce, BLANK() ) - 7 years ago
Anonymous -
The entire code block is your calculated column. Documentation on using VAR can be found @ https://docs.microsoft.com/en-us/dax/var-dax and a nice example article can be found @ https://www.sqlbi.com/articles/variables-in-dax/
- 7 years ago
Anonymous -
You're missing closing ' ) ' in a couple places.
Copy -> Paste my code and replace 'Table1' with 'Primary_ID' or try formatting multi-line by clicking ALT + ENTER so you can see your opening and closing Parentheses ' ( ' & ' )' respectively a little easier.
Anonymous -
Would the below work for you?
Var =
VAR nextRank = Table1[Rank] + 1
VAR differnce =
CALCULATE(
VALUES(Table1[Value]),
FILTER(ALLEXCEPT(Table1,Table1[Type]),Table1[Rank] = nextRank)
) - Table1[Value]
RETURN
IF(
differnce >= 0,
differnce,
BLANK()
)Hi Chris,
I'm afraid I don't really understand your reply (my fault).
Which bit, exactly, do I need to type into my formula bar?
Many thanks
Peter
- Anonymous7 years agoNot applicable
In particular I don'r understand how to feed this expression into the formula;
Var = VAR nextRank = Table1[Rank] + 1
Thanks
- ChrisMendoza7 years agoResident Rockstar
Anonymous -
The entire code block is your calculated column. Documentation on using VAR can be found @ https://docs.microsoft.com/en-us/dax/var-dax and a nice example article can be found @ https://www.sqlbi.com/articles/variables-in-dax/
- Anonymous7 years agoNot applicable
Many thanks Chris.
I'll give it a go!