Search code examples
reporting-servicesreport

How to use count number of rows which meet the condition in ssrs report?


In my report I want to count number of rows with condition. For example Count Mondays, count weekdays, count Saturdays, etc.

enter image description here

I try with this :

=countdistinct(iif(weekday(Fields!DATE_YYYYMMDD.Value,2)=1,Fields!N_ENTERED.Value,0))

but give me the result 18. I expected 1, because I have only 1 monday between 09.06.2019 and 16.06.2019

The entered value is entered calls from employees.


Solution

  • Your countdistinct is returning the number of unique values you have in your N_ENTERED field, not the number of Mondays.

    To just count the number of Mondays, you need to reference the result of your iif instead:

    =sum(iif(weekday(Fields!DATE_YYYYMMDD.Value,2)=1, 1, 0))