简体   繁体   English

SSRS 获取筛选组数

[英]SSRS Get number of filtered groups

Working with dynamics 365 reports has brought me to the next issue.使用 dynamics 365 报告让我进入下一期。 Because FetchXML doesn't support NOT EXISTS condition, i have to filter data inside report.因为 FetchXML 不支持 NOT EXISTS 条件,所以我必须在报告中过滤数据。
The case is that I have like 7000 rows and I group them by account (around 2000 groups).情况是我有 7000 行,我按帐户对它们进行分组(大约 2000 组)。
And used filter on group.并在组上使用过滤器。
And after that i've got:之后我得到了:
| | account |帐户 | data |数据 |
|----------| |----------| ----------| ----------|
| | apple___ |苹果___ | some_data |一些数据 |
| | samsung|三星| more_data |更多数据 |
| | lg_______ | LG______ | next_data |下一个数据 |
So after grouping and filtering i have only 3 groups (accounts).所以在分组和过滤之后我只有 3 个组(帐户)。
But how to achieve this value (3) in report?但是如何在报告中实现这个值(3)呢?
CountDistict(Field.account.Value) includes all nonfiltered accounts. CountDistict(Field.account.Value)包括所有未过滤的帐户。
CountDistict(Field.account,Value, "filteredAccGroup") outside the group throws "The Value expression for the text box 'Textbox145' has a scope parameter that is not valid for an aggregate function."组外的CountDistict(Field.account,Value, "filteredAccGroup")抛出“文本框‘Textbox145’的值表达式具有 scope 参数,该参数对于聚合 function 无效。” Have no other ideas.没有别的想法。
I need the count (or number) of all filtered groups.我需要所有过滤组的计数(或数量)。 Current index of group would also be nice.当前的组索引也很好。
Thanks.谢谢。

Solution:解决方案:
Found the solution.找到了解决方案。 But not sure this is the optimal one.但不确定这是最佳的。
Outside the group:群外:

CountDistinct(iif(min(Fields!date.Value, "account_group") >= CDate("01/01/2021"),
Fields!account.Value, nothing))

Under iif is the condition i have filtered the group.在 iif 下是我过滤组的条件。

Assuming your dataset is called DataSet1 then the following should work.假设您的数据集称为DataSet1 ,则以下内容应该有效。

=CountDistinct(Fields!account.Value, "DataSet1")

As usual, the scope has to be in quotes and is case sensitive.和往常一样,scope 必须用引号引起来并且区分大小写。

Outside the group:群外:

 CountDistinct(iif(min(Fields.date,Value, "account_group") >= CDate("01/01/2021"). Fields,account.Value, nothing))

Under iif is the condition i have filtered the group.iif下是我过滤组的条件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM