cancel
Showing results for
Did you mean:
Helper IV

## Count number of blank columns in table visualization using date slicer-DAX

Hi All,

In below student table, I have few column with blank values for LastAttendanceDate. I created a measure to calculate the number of blank columns for LastAttendanceDate.

The calculated measure is as below :-

m1 = COUNTROWS(student) --> To count total rows
m3 = Count(student[LastAttendanceDate])-->To count blank values in the  LastAttendanceDate columns
m2= m1-m3 -->To find the nonblank rows
Input data for student table:
 StudentID StudentName LastAttendanceDate StudentType 100 Mary 02-05-2011 10:45 Fulltime 100 Mary Fulltime 100 Mary 04-05-2011 12:45 Fulltime 100 Mary 06-05-2011 15:45 Fulltime 100 Mary Fulltime 100 Mary 08-05-2011 19:45 Fulltime 100 Mary 09-05-2011 12:45 Fulltime 101 John 02-05-2011 10:45 Part Time 101 John 03-05-2011 11:23 Part Time 101 John 04-05-2011 10:45 Part Time 101 John 06-05-2011 15:49 Part Time 101 John Part Time 101 John 08-05-2011 19:45 Part Time 101 John Part Time 101 John 10-05-2011 19:45 Part Time 101 John 11-05-2011 12:45 Part Time

Right now the results are returning the total number of blank values for the LastAttendanceDate column of the Student table.

Is there a way I can control these numbers of blank columns displayed when i select any date range [minimum or maximum ] in my date slicer?

For example : if i select date range as 06-05-2011 to 08-05-2011 in date slicer then it should show column with blank values as 2 while in a range 02-05-2011 to 04-05-2011 it should show column with blank value as 1

Kind regards

sameer

1 ACCEPTED SOLUTION
Community Support

According to your needs, I created a measure to count the value of blank in the table. The allselected function is used to retain the filter conditions of the external slicer.

``````M =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table'[LastAttendanceDate] ),
'Table'[LastAttendanceDate] = BLANK ()
)
)``````

Here is the sample pbix file link.

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 REPLIES 4
Community Support

According to your needs, I created a measure to count the value of blank in the table. The allselected function is used to retain the filter conditions of the external slicer.

``````M =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
ALLSELECTED ( 'Table'[LastAttendanceDate] ),
'Table'[LastAttendanceDate] = BLANK ()
)
)``````

Here is the sample pbix file link.

If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

Best Regards,
Henry

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helper IV

Thankyou for the approach

Helper IV

thankyou it helped and it worked

Super User III

Hi,

In the Query Editor, seperate the time stamp from the LastAttendanceDate column into another column and remove the time coolumn if you do not need it for any analysis.  Create a Calendar Table and build a relationship from the Date column (Date extracted from the LastAttendanceDate column) to the Date column of the Calendar Table.  Build your slicer from the Date column of the Calendar Table.  Thereafter use the COUNNTBLANK function.

Regards,
Ashish Mathur
http://www.ashishmathur.com

Announcements