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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

Measure counts date field and filters on date

Hi guys, 

 

I am currently trying to create a measure that counts a date field and filters on the date. The measure looks something like this 

New Contract Fiscal YTD = CALCULATE(COUNT('TableName'[Agreement Date]), FILTER('TableName', 'TableName'[Agreement Date] >= 4/1/2021))
 
It brings me back a count of the field but does not filter it down based on the date I put in. Any thoughts ?? 
1 ACCEPTED SOLUTION
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous 

 

Please make a little bit change to your Measure like this:

New Contract Fiscal YTD = CALCULATE(COUNT('TableName'[Agreement Date]), FILTER('TableName', 'TableName'[Agreement Date] >= DATE(2021,4,1)))

 

Then you should see the result like this:

vcazhengmsft_0-1635662909067.png

 

Best Regards,

Community Support Team _ Caiyun

 

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

 

 

 

View solution in original post

3 REPLIES 3
v-cazheng-msft
Community Support
Community Support

Hi @Anonymous 

 

Please make a little bit change to your Measure like this:

New Contract Fiscal YTD = CALCULATE(COUNT('TableName'[Agreement Date]), FILTER('TableName', 'TableName'[Agreement Date] >= DATE(2021,4,1)))

 

Then you should see the result like this:

vcazhengmsft_0-1635662909067.png

 

Best Regards,

Community Support Team _ Caiyun

 

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

 

 

 

Anonymous
Not applicable

This worked perfectly! Thanks for that. I have a quick question, I wanted to do something similar like this but have the filter be the oldest date that is active in the table. I created a measure that grabs the oldest date that is active then tried to use that as the filter. Any suggestions? 

Oldest Exp Date Amount = CALCULATE(SUM('TableName'[Contract Amount]), FILTER('TableName',[Oldest Expiration Date]))
 
and this is what the oldes expiration date measure looks like 
Oldest Expiration Date = CALCULATE(MIN('TableName'[Expiration Date]), FILTER('TableName', 'TableName' Fields'[Status] = "Active"))
rodrigosan
Resolver III
Resolver III

Hello friend, see if this solution suits you.
I made the file available in my folder on GitHub:

https://github.com/roolsant/SOSPowerBI/blob/main/wsmith1.zip

What I did was create a measure of COUNT and then I created another one by applying the filter.
it is possible to apply the filter directly as below:
But I use the date in numeric format:
CountFiltered = CALCULATE(COUNT(fSales[Date]), fSales[Date] >= 44200)

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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