Forum Discussion
Counting blank fields based on another column
I am trying to count how many blank cells I have in my 'status' column when my 'appt date/time' field has a value in the cell. I have tried the following formula
I was not able to get it to work, so I used a subtraction formula from the other result status' to get my correct answer.
19 Replies
- FBergamaschiSuper User
Please provide the pbix file for inspection
Best
FB
- mgaut341Helper II
- FBergamaschiSuper UserHi mgaut341No as I am not allowed in your Tenant, can you attach the pbix here in your reply?
- DataNinja777Super User
Hi mgaut341 ,
To count how many rows have a blank Status while the Appt Date/Time is not blank, you need to use COUNTROWS with a FILTER that checks both conditions. Your current formula only checks if Status is blank, which includes rows even when Appt Date/Time is also blank. The correct DAX formula is:
CALCULATE( COUNTROWS('CCHHS Imaging & Procedure'), FILTER( 'CCHHS Imaging & Procedure', NOT(ISBLANK('CCHHS Imaging & Procedure'[Appt Date/Time])) && ISBLANK('CCHHS Imaging & Procedure'[Status]) ) )This will return the number of rows where Status is blank and Appt Date/Time has a value.
Best regards,
- mgaut341Helper II
Unfortunately, that tells me I have 0 blank cells which is not accurate as I have 76
- v-saisrao-msftCommunity Support
Hi mgaut341,
Please provide sample PBIX file that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data?https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...Thank you.
- Rupak_biSuper User
Hi mgaut341 ,
unable to get the sample data. However, to solve this,
Create a calculated column with below syntax and get a sum.
column = if(and(date/time <> blank() , status = blank()) , 1, blank())
this flag column should put 1 in case of status blank and date/time not blank.
then you need to sum it up.
Let me know if this works. Else, share sample data
- Rupak_biSuper User
Hi mgaut341 ,
unable to get the sample data. However, to solve this,
Create a calculated column with below syntax and get a sum.
column = if(and(date/time <> blank() , status = blank()) , 1, blank())
this flag column should put 1 in case of status blank and date/time not blank.
then you need to sum it up.
Let me know if this works. Else, share sample data
- v-saisrao-msftCommunity Support
Hi mgaut341,
I can't access your PBIX file. The error message indicates it does not exist in the tenant, so please share the sample file with access.
Thank you.
- v-saisrao-msftCommunity Support
Hi mgaut341,
checking in to see if your issue has been resolved. And share the sample data or Pbix file.
Please let us know if you still need assistance.Thank you.
- mgaut341Helper II
I was not able to get it to work, so I used a subtraction formula from the other result status' to get my correct answer.
- v-saisrao-msftCommunity Support
Hi mgaut341,
Glad your issue has been resolved. Please mark your reply as the solution, as it will help other community members.
Thank you.