I am using Report Studio 8.4 to extract data.

I want to obtain the 2012 information of the following fields:

- Store ID
- Store Size
- Sales 2012
- Quartile Indicator (~ this data item should be created. Its valule could be: 1, 2, 3, or 4.)

The stores are classified by Size as A, B, and C (A > B > C).

The data should be sorted by Sales for each store size (and then be assigned with Quartile Indicator. For example,

Store Number Store Size Code Sales 2012

116 A 57155

109 A 57202

114 A 57960

111 A 67199

118 A 67199

107 A 67914

106 A 67917

104 A 67932

117 A 67955

113 A 77199

115 A 77199

101 A 77920

112 A 87922

102 A 97955

103 A 233211

108 A 236709

110 A 332312

100 A 670689

105 A 745423

132 B 1670

126 B 37199

131 B 37199

120 B 37201

129 B 37947

125 B 37958

123 B 37964

130 B 47932

124 B 57201

127 B 57936

128 B 67932

122 B 137199

121 B 237936

119 B 337967

138 C 17958

141 C 27960

134 C 29679

133 C 37196

148 C 37196

139 C 37199

143 C 37199

145 C 37201

150 C 37201

144 C 37205

136 C 37922

142 C 37958

140 C 37960

147 C 37978

149 C 47924

135 C 57958

146 C 67201

137 C 77960

My questions are:

1) How to rank the Sales and divide them into quarters for each store size?

2) How to write Data Item Expression for Quartile Indicator whose value could be 1, 2, 3, or 4?

Thank you in advance.