简体   繁体   中英

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.

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. 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.

=CountDistinct((Fields!ID.Value)+(Fields!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)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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