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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

counts rows for dates between

Hi All,

 

I need to count the number of closed tickets in a table between 2 dates. 

I have a date table connected to my data table

Date and data table relationship.PNG

To get a closed date I had to use an if statement: 

Closed Date = IF(Query1[Date]<>"",Query1[Date],Query1[Date.1]) but the column is formatted as a date. 
I've tried a few measures to count closed tickets between 01/08/2018 to 
31/07/2019 but the output is wrong?
 
Help.. how can I do this?
 
1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi  @Anonymous ,

 

To create a measure as below.

Measure =
CALCULATE (
    COUNTROWS ( Query1 ),
    FILTER (
        Query1,
        Query1[Closed Date] >= DATE ( 2018, 08, 01 )
            && Query1[Closed Date] <= DATE ( 2019, 07, 31 )
    )
)

 

If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi  @Anonymous ,

 

To create a measure as below.

Measure =
CALCULATE (
    COUNTROWS ( Query1 ),
    FILTER (
        Query1,
        Query1[Closed Date] >= DATE ( 2018, 08, 01 )
            && Query1[Closed Date] <= DATE ( 2019, 07, 31 )
    )
)

 

If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Worked perfectly, thanks

MartynRamsden
Solution Sage
Solution Sage

Hi @Anonymous 

 

Try this as a measure:

 

Closed Tickets =
CALCULATE (
    COUNTROWS ( Query1 ),
    DATESBETWEEN (
        Calendar,
        DATE ( 2018, 08, 01 ),
        DATE ( 2019, 07, 31 )
    )
)

 

You can, of course, make this a dynamic measure by replacing the hardcoded dates in the DATESBETWEEN function.

 

Hope it helps.


Best regards,

Martyn

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.