locked
Alternative row colors for every 3 rows RRS feed

  • Question

  • Hi,

    How can i get alternate row colors for every 3 rows in below format?

     

    1 apple
    2 pear
    3 guava
    4 mango
    5 pineapple
    6 orange
    7 grapes
    8 watermelon
    9 banana
    10 cantelope

     

     

    Tuesday, April 19, 2011 11:20 PM

Answers

  • Hey, I know it's too long but it works..you can make it short somehow if you have time..
    = IIf(RowNumber(nothing) Mod 12= 4, "Red", IIf(RowNumber(nothing) Mod 12= 5, "Red", IIf(RowNumber(nothing) Mod 12= 6, "Red", IIf(RowNumber(nothing) Mod 12= 10, "Red", IIf(RowNumber(nothing) Mod 12= 11, "Red", IIf(RowNumber(nothing) Mod 12= 0, "Red", "Blue"))))))
    Thanks
    -Hardik (My Blog)
    • Proposed as answer by Hardik Bhavsar Wednesday, April 20, 2011 12:48 AM
    • Marked as answer by Sandy SSRS Wednesday, April 20, 2011 6:49 PM
    Wednesday, April 20, 2011 12:48 AM
  • Hardik sort of beat me to it.

    My formula is a bit shorter though

    =iif((RowNumber(Nothing) mod 6 = 1 Or RowNumber(Nothing) mod 6 = 2 Or RowNumber(Nothing) mod 6 = 3), "Blue", "Green")

    you should apply this expression against the relevant Tablix row's BackgroundColor property

     

     


    Craig Bryden - Please mark correct answers
    • Marked as answer by Sandy SSRS Wednesday, April 20, 2011 6:49 PM
    Wednesday, April 20, 2011 12:54 AM

All replies

  • Hey, I know it's too long but it works..you can make it short somehow if you have time..
    = IIf(RowNumber(nothing) Mod 12= 4, "Red", IIf(RowNumber(nothing) Mod 12= 5, "Red", IIf(RowNumber(nothing) Mod 12= 6, "Red", IIf(RowNumber(nothing) Mod 12= 10, "Red", IIf(RowNumber(nothing) Mod 12= 11, "Red", IIf(RowNumber(nothing) Mod 12= 0, "Red", "Blue"))))))
    Thanks
    -Hardik (My Blog)
    • Proposed as answer by Hardik Bhavsar Wednesday, April 20, 2011 12:48 AM
    • Marked as answer by Sandy SSRS Wednesday, April 20, 2011 6:49 PM
    Wednesday, April 20, 2011 12:48 AM
  • Hardik sort of beat me to it.

    My formula is a bit shorter though

    =iif((RowNumber(Nothing) mod 6 = 1 Or RowNumber(Nothing) mod 6 = 2 Or RowNumber(Nothing) mod 6 = 3), "Blue", "Green")

    you should apply this expression against the relevant Tablix row's BackgroundColor property

     

     


    Craig Bryden - Please mark correct answers
    • Marked as answer by Sandy SSRS Wednesday, April 20, 2011 6:49 PM
    Wednesday, April 20, 2011 12:54 AM