Forum Discussion
Comparison measure not working when using Sort By on a column
- 4 years ago
Hi Anonymous
This is related with the way that the filtering of a column is calculated when you use the CALCULATE, the use of the expression of a table is like you are using the ALL statetment, in this case when you place the value of the version it gets incorrect.
Try the following code:
USD Cst1 vs LY Act % V2 = VAR PREVYR = SELECTEDVALUE('Calendar'[Year])-1 VAR BASELINE = CALCULATE([USD Cst1], 'Calendar'[Year]=PREVYR,'Map_Version'[Version]="ACT", ALLSELECTED(Map_Version)) RETURN DIVIDE([USD Cst1]-BASELINE,BASELINE,0)Has you can see the result is the same even when you change the order:
Hi Anonymous
This is related with the way that the filtering of a column is calculated when you use the CALCULATE, the use of the expression of a table is like you are using the ALL statetment, in this case when you place the value of the version it gets incorrect.
Try the following code:
USD Cst1 vs LY Act % V2 =
VAR PREVYR = SELECTEDVALUE('Calendar'[Year])-1
VAR BASELINE = CALCULATE([USD Cst1], 'Calendar'[Year]=PREVYR,'Map_Version'[Version]="ACT", ALLSELECTED(Map_Version))
RETURN
DIVIDE([USD Cst1]-BASELINE,BASELINE,0)
Has you can see the result is the same even when you change the order:
It is WORKING 🙂 An ENORMOUS Than you for your help - very much appreciated!