[英]Distinct count on multiple columns - ssrs report
I am new to ssrs and I am working on a report where I need to get a distinct count on two columns to display the total. 我是ssrs的新手,我正在研究一个报告,在该报告中我需要在两列上获得不同的计数以显示总数。
Table/Dataset format: 表/数据集格式:
ID CREATEDATE
123 03/01/2015 11:20 pm
123 03/01/2015 11:20 PM
123 NULL
123 03/20/2015 05:15 PM
345 04/01/2015 05:20 PM
Datatypes: 资料类型:
ID - Int
CreateDate - Datetime
If I get a distinct count on the above ex it should return 3 - First two rows have the same ID and Datetime. 如果我在上述ex上得到不同的计数,则应该返回3-前两行具有相同的ID和Datetime。 Eliminate Null records from the count
从计数中消除空记录
I tried something like following it works in all scenarios except when there is null value in a row it shows #error in the output. 我尝试了类似以下的操作,它在所有情况下都适用,除了当一行中有空值时,它在输出中显示#error。
=CountDistinct((Fields!ID.Value)+(Fields!CREATEDATE.Value.ToString()))
= CountDistinct((字段!ID.Value)+(字段!CREATEDATE.Value.ToString()))
Could anyone please suggest either how to eliminate null value in my distinct count or better way to do this. 谁能建议我以不同的方式消除空值,或者提出更好的方法。 Appreciate your time and help.
感谢您的时间和帮助。
Thanks 谢谢
尝试这个
=CountDistinct(CStr(Fields!ID.Value)+CStr(Fields!CREATEDATE.Value))
我尝试了以下方法,到目前为止,它似乎仍然有效。
=CountDistinct(IIF(IsNothing(Fields!CREATEDATE.Value),Nothing,CStr(Fields!ID.Value)+CStr(Fields!CREATEDATE.Value)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.