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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
U-ALE
New Member

Creating a Count measurement with date filter

Hey, first time posting here.

 

I'm trying to create a measurement of sold units during a certain time period without having a visual filter.

 

Count SR with date = CALCULATE(COUNT (base'[SerialNumber]), DATESBETWEEN(([Sold Date], DATE(2021,04,01), DATE(2022,05,31))))
 
I can't get it to work.. The error I get is "Operator or expression '( )' is not supported in this context."
 
Appreciate all help! 
1 ACCEPTED SOLUTION
JMarv
New Member

Try:

 

Count SR with date = CALCULATE(COUNT(base'[SerialNumber]), DATESBETWEEN(base'[Sold Date], DATE(2021,04,01), DATE(2022,05,31)))

 

The main issue with the original formula was the extra set of parentheses around the first argument of the DATESBETWEEN function. The correct syntax is to only include the column reference base'[Sold Date] as the first argument of DATESBETWEEN.

View solution in original post

2 REPLIES 2
U-ALE
New Member

Thanks, 

 

Such a easy fix.. Feels like I tried everything.. 

JMarv
New Member

Try:

 

Count SR with date = CALCULATE(COUNT(base'[SerialNumber]), DATESBETWEEN(base'[Sold Date], DATE(2021,04,01), DATE(2022,05,31)))

 

The main issue with the original formula was the extra set of parentheses around the first argument of the DATESBETWEEN function. The correct syntax is to only include the column reference base'[Sold Date] as the first argument of DATESBETWEEN.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.