Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
deb_power123
Helper V
Helper V

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:
StudentIDStudentNameLastAttendanceDateStudentType
100Mary02-05-2011 10:45Fulltime
100Mary Fulltime
100Mary04-05-2011 12:45Fulltime
100Mary06-05-2011 15:45Fulltime
100Mary Fulltime
100Mary08-05-2011 19:45Fulltime
100Mary09-05-2011 12:45Fulltime
101John02-05-2011 10:45Part Time
101John03-05-2011 11:23Part Time
101John04-05-2011 10:45Part Time
101John06-05-2011 15:49Part Time
101John Part Time
101John08-05-2011 19:45Part Time
101John Part Time
101John10-05-2011 19:45Part Time
101John11-05-2011 12:45Part 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

1.JPG

Kind regards

sameer

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @deb_power123 ,


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 ()
    )
)

v-henryk-mstf_0-1615451857316.png

v-henryk-mstf_1-1615451880877.png

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.

View solution in original post

4 REPLIES 4
v-henryk-mstf
Community Support
Community Support

Hi @deb_power123 ,


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 ()
    )
)

v-henryk-mstf_0-1615451857316.png

v-henryk-mstf_1-1615451880877.png

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.

Thankyou for the approach

thankyou it helped and it worked

Ashish_Mathur
Super User
Super User

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
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.