Forum Discussion

U-ALE's avatar
U-ALE
New Member
3 years ago
Solved

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! 
  • 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.

2 Replies

  • Thanks, 

     

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

  • 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.