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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Ryanb2412
Helper I
Helper I

Measure to Count rows with total 0

Hey All,

 

I am trying to get a count of contracts that are expired in this dashboard.  The data table looks like this:

 

Table Name "MRL"

EmployeeDays to Expiration
Emp A0
Emp B45

Emp C

 
Emp D0
Emp E 
Emp F22

 

I am trying to build a measure that will count the # of expired contracts, but it isn't working for me.  The card should show "2" as the answer if the measure functions correctly.  The blank rows have to stay in the data because there are some reps where we do not have their contract date terms on file currently.

 

I initially tried using this formula below, but it was counting the blank rows as zeros, which I do not want it to do and was giving me an answer of "4".

Expired Contracts = CALCULATE(COUNTROWS(MRL), MRL[Days to Expiration] = 0)

 

So I changed to the formula below, but now the card visual just shows "(Blank)" even though the measure is formatted to provide a whole number.

Expired Contracts = CALCULATE(COUNTROWS(MRL), MRL[Days to Expiration] <> BLANK(), MRL[Days to Expiration] = 0)

 

Any help would be greatly appreciated!

 

 

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Ryanb2412 

Change your first formula to use the strict equal to of ==

 

Expired Contracts = CALCULATE(COUNTROWS(MRL), MRL[Days to Expiration] == 0)

 

https://docs.microsoft.com/en-us/dax/dax-operator-reference

All comparison operators except == treat BLANK as equal to number 0, empty string "", DATE(1899, 12, 30), or FALSE. As a result, [Column] = 0 will be true when the value of [Column] is either 0 or BLANK. In contrast, [Column] == 0 is true only when the value of [Column] is 0.

 

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

@Ryanb2412 

Change your first formula to use the strict equal to of ==

 

Expired Contracts = CALCULATE(COUNTROWS(MRL), MRL[Days to Expiration] == 0)

 

https://docs.microsoft.com/en-us/dax/dax-operator-reference

All comparison operators except == treat BLANK as equal to number 0, empty string "", DATE(1899, 12, 30), or FALSE. As a result, [Column] = 0 will be true when the value of [Column] is either 0 or BLANK. In contrast, [Column] == 0 is true only when the value of [Column] is 0.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.