Forum Discussion
Conditional Formatting of Alternating Column Colors Breaks When Filtering
- 3 years ago
Hi Anonymous ,
This is related with the RANKX part of your calculation in RANK you need to use the RANKX on a measure there is the need to force the iteration between rows and that is made using the CALCULATE in this case you need to redo your measure to:
Formatting - AlternateColumns = VAR SelectedCode = SELECTEDVALUE('Table'[Code]) VAR RankTable = ALLSELECTED('Table'[Code]) VAR CodeRank = RANKX ( RankTable, CALCULATE(MAX('Table'[Code])), SelectedCode, ASC, Dense ) VAR ConditionalFormatting = IF(ISEVEN(CodeRank), "Lightblue", "Lightgreen") RETURN ConditionalFormattingAs you can see I have changed the Table[Code] by a CALCULATE(MAX(Table[Code])) this will force the line by line iteraction that the RANKX needs (blog post with explanation😞
Hi Anonymous ,
This is related with the RANKX part of your calculation in RANK you need to use the RANKX on a measure there is the need to force the iteration between rows and that is made using the CALCULATE in this case you need to redo your measure to:
Formatting - AlternateColumns =
VAR SelectedCode = SELECTEDVALUE('Table'[Code])
VAR RankTable = ALLSELECTED('Table'[Code])
VAR CodeRank =
RANKX
(
RankTable,
CALCULATE(MAX('Table'[Code])),
SelectedCode,
ASC,
Dense
)
VAR ConditionalFormatting = IF(ISEVEN(CodeRank), "Lightblue", "Lightgreen")
RETURN ConditionalFormatting
As you can see I have changed the Table[Code] by a CALCULATE(MAX(Table[Code])) this will force the line by line iteraction that the RANKX needs (blog post with explanation😞