如何指定矩阵中列的顺序?

发布于 2024-07-11 20:01:57 字数 308 浏览 9 评论 0原文

我正在编写一个 SQL Reporting Services 报告(在 VS.Net 2005 中),它显示矩阵中不同数据的计数。 这些列对特定集合中的客户数量进行了计数。 所以我有几个这样的栏目:“1 名雇主”、“2-9 名雇主”、“10-19 名雇主”等等。

我遇到的问题是 SQL Reporting Services 按字母顺序对矩阵中的列进行排序。 因此,我最终在“1 雇主”列之后但在“2-9”之前得到了“10-19”列。

有没有什么办法解决这一问题? 或者也许有一个技巧可以将列的标签更改为正确排序的?

谢谢。

I'm working on a SQL Reporting Services report (in VS.Net 2005) which displays a count of different data in a matrix. The columns have a count on the amount of customers in a certain set. So I have several columns like these: "1 employer", "2-9 employers", "10-19 employers" and so on.

The problem I have is that SQL Reporting Services sorts the columns in the matrix alphabetically. So I end up having the "10-19" column after the "1 employer" column but before the "2-9".

Is there any way to fix this?
Or maybe a trick to change the labels of the columns to that they sort right?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

猫七 2024-07-18 20:01:58

这也可以通过向排序顺序的查询添加新列来完成。 然后右键单击矩阵中的列组并选择组属性。 在左侧选择排序。 从这里您可以指定另一列作为排序依据,而不是列标题。 无需自定义公式。

This can also be done by adding a new column to the query for the sort order. Then right click the column group from the matrix and select group properties. On the left hand side select sorting. From here you can specify another column to sort by instead of the column header. No custom formula needed.

☆獨立☆ 2024-07-18 20:01:58

我们做了很多 SSRS 报告,这始终是 mdx 的一个问题。 我们这样做的一种方法是:

分组和排序属性中设置排序以按此表达式排序:

=iif(Fields!DataSetField.Value = "ColumnName", "zzz", Fields!DataSetField.Value)

其中“zzz”可以是数字或您需要的任何内容帮助排序,然后根据该表达式选择方向作为升序或降序。

We do a lot of SSRS Reports and this was always an issue with mdx. Here is one way we do it:

Set Sorting in the Grouping and Sorting Properties to sort by this expression:

=iif(Fields!DataSetField.Value = "ColumnName", "zzz", Fields!DataSetField.Value)

Where "zzz" could be a number or whatever you need it to be to help the sort and then select Direction as either Ascending or Descending base on this expression.

鸠魁 2024-07-18 20:01:58

这可能有点复杂,但我们也遇到过类似的问题,而且没有办法改变 SQL。
我们所做的是在数据集中创建一个计算字段,该字段为每列返回一个数字,并根据该数字对组进行排序。

This may be a bit convoluted, but we had a similar problem and no means to change the SQL.
What we did was create a calculated field in the dataset that returns a number for each column and sorted the group on that number.

轻拂→两袖风尘 2024-07-18 20:01:58

我遇到了类似的问题,但没有及时找到使用矩阵的解决方案 - 所以我使用了一个表 - 并将所需的矩阵逻辑放入我的 SQL 语句中。
这不是最好的做法,但它确实有效——它足够快,而且不需要花那么长时间来编写。

I had a similar problem but did not find a solution using a matrix in time - so I used a table - and put the needed logic of the matrix in my SQL-statements.
It's not the best thing to do but it works - it's fast enough and it don't takes that long to write.

恍梦境° 2024-07-18 20:01:58

我进入了 MATRIX --> 属性 --> 团体。
然后,我“移动”了我希望它在列表中按 UP 排序的 GROUP。
我去了 PREVIEW,效果非常好。
它甚至使我的专栏顺序保持不变。

I went into MATRIX --> PROPERTIES --> GROUPS.
Then, I "moved" the GROUP I wanted it to sort by UP in the list.
I went to PREVIEW, and it worked perfectly.
It even kept my column order the same.

陈甜 2024-07-18 20:01:58

转到编辑组 - 排序 - 将表达式的方向更改为降序。

Go to Edit Group - Sorting - Change the direction to descending for the expression.

假装不在乎 2024-07-18 20:01:58

对于 Tablix 的不同数字顺序,请在表达式中使用以下代码行。

=RunningValue(CountDistinct("您的表名"),计数,"您的表名")

For distinct numeric order of a Tablix use following line of code in expression.

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

七颜 2024-07-18 20:01:58

只需转到 tablix/Matrix Column Group 并右键单击组属性,然后进行排序并从排序中删除自动添加的记录。现在,您的排序将基于您在数据集中添加的数据。

Simply Go to tablix/Matrix Column Group and Right Click on the Group Properties then go Sorting and Delete the auto added record from Sorting.. Now your sorting will based on the Data you have added in Data set.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文