SSRS Row Group + Column Group = RowNumber Issue

别说谁变了你拦得住时间么 提交于 2019-12-23 08:47:38

问题


I'm back with another SSRS question :-)

I'm dealing with survey data. I have a procedure that's returning an organization's response counts per question. So my report is defined as Group on Organization for row and Group on answer for columns. Both the number of organizations and answers are variable. That's working as expected. I've tried adding a RowCount next to the organization so that I can show rank, but the fact that each org has one row per question means that I'm getting eight rows per org.

Here's an example:

Here is my report definition:


The rank expression is currently: =RowNumber(Nothing)

Ideally, the rank would be 1, 2, 3, 4, etc... I've tried scope to the row group, column group and nothing. No help.

Any assistance would be greatly appreciated!


回答1:


Had same frustrating issue; lots of time wasted. Eventually, this solution also helped:

=RunningValue(CountDistinct("YourTableName"),Count,"YourTableName")

Trick here is NOT to use the name of the group within the table/matrix, but the name of the table itself. And yes, one would think that using the table name for the scope in the function RowNumber should work, but it doesn't.




回答2:


Try using:

runningvalue(Fields!AnswerText.Value,CountDistinct,"NameOfOrganizationGroup") 

If its a matrix, change the name of the scope from the row scope to the matrix scope.




回答3:


I do with custom code.

Add this to code section on report config:

Dim private count as integer = 0
Dim private iniRow as integer = 0
Public function nroFila(Byval rowNum as integer) as integer
    if iniRow = 0 then
        iniRow = rowNum
    end if

    if rowNum = iniRow then
        count = 0
    end if

    count = count + 1
    Return count
End function

Then, call the function in a cell inside the group:

=Code.nroFila(RowNumber(Nothing))



回答4:


I seem to have found a solution, but it feels like a hack... I'm leaving this unanswered to see if someone else can provide a better solution (read less hackish).

My Rank Expression is now:
=RowNumber(Nothing)/Count(Fields!AnswerText.Value)

Everything seems to be ok. I suppose I should IIf(Count... = 0, Then RowNumber, else what I've got...




回答5:


Best thing to do here, is make the Rank column equal to =RowCount()/8

Since your sure each visible row contains a total of 8 rows, this should work fine.




回答6:


Add another rank column next to the existing one and put another expression in that one which takes the value from rank (rowcount?) and divide it by 8. Then make the old rank column invisible.




回答7:


Are you absolutely certain that using RowNumber("NameOfOrganizationGroup") doesn't work?

Click on the matrix, click the upper-left corner selection box to select the entire thing, then right-click on the selection border and get properties. Switch to the Groups tab and look at the names of the groups in the Rows section. That's what goes in the scope of the RowNumber() function.

If you already know this and tried it, my apologies—I didn't mean to assume you didn't know. It's just not 100% clear from your question that this is not the solution.



来源:https://stackoverflow.com/questions/1826440/ssrs-row-group-column-group-rownumber-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!