SSRS 2008 RowNumber() giving random values in matrix
Hi all, i have a matrix with 4 nested rowgroups. Group1->...Group4 When i put =rownumber("Group1") into one of the fields of the matrix I get random numbers like 24, 12, 12, 12, 24,12, 12, 12, 32 and these are all for the same value in Group1! I'm trying to find out when my report rolls over to the next group value in Group1. I've tried a few combinations of running value and other things but i either get 1 appearing in all the rows or the high numbers What am I doing wrong?
July 20th, 2012 3:04am

Hey Jakubk, When you place a RowNumber(Scope) in a matrix, it returns the aggregate of the number of rows pertaining to the lowest level of your Column group. For example, consider the image below: As you can see the RowNumber("Year") expression returns 5 and 13 for 2012-July and 2012-August. That is because, in my dataset, - 1. There are 5 records for 2012-July and 2. There are 8 records for 2012-August, but for the cell of August in my matrix, it displays the previous value + number for the current month, which is 5 + 8 = 13. I am guessing the same also applies with your case. Let me know if you need more info. HTH. Cheers, IceQBPlease mark correct answers :)
Free Windows Admin Tool Kit Click here and download it now
July 20th, 2012 5:52am

Hi There Thanks for your posting. Please try this. Open the report properties (right click on blank area outside the layout and click properties) or (Menu-->Report-->Report Properties) Click on the code pane on the left In the code window enter below script dim Counter as integer=0 Public function getCounter() as Integer Counter=Counter+1 return Counter end function dim Counter as integer=0 Public function getCounter() as Integer Counter=Counter+1 return Counter end function Go to the properties of the group (based on which group you need the group serial number) Click the variables tab on the left Click on Add and set Name as GroupCountValue and set the expression (in the expression window) as =Code.getCounter, click ok and close the window. Now in the textbox where you want to display the Serial number, set the expression as =Variables!GroupCountValue.Value Run the report and observe the result I hope this will help If you have any question please do ask Many thanks Syed Qazafi Anjum
July 20th, 2012 6:48am

hi iceqb, I'm sure that's what's causing it because I dont have a detail row in my matrix. The lowest grain on the report is grouped and aggregated Now, this behaviour for rownumber confuses and disturbs me because it's behaving more like a count() Is it possible to get rownumber() to display 1 and 2 in the example you used? I've got it working using Previous(), because i dont really care what the rownumber is, i just thought i could use an expression to check if rownumber(current row group) = 1 and do something. Previous(value) != value will give me the same behaviour
Free Windows Admin Tool Kit Click here and download it now
July 20th, 2012 9:56pm

Hi Jakubk, Base on my research, the RowNumber function in the Matrix is totally different with it in the table because you are always dealing with grouped data in a matrix. So the result was not as expected in your report. In you scenario, you can you can try to use custom code to achieve this just as Syeds suggestion. Hope this helps. Regards, Charlie Liao
July 23rd, 2012 5:41am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics