cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Count tickets opened and closed in the same month

Hi all 

 

I need to create a count of all ticket where the creation and closure date occurs in the same month.

 

If the reference ID was created between 01/01/2020 and 31/01/2020 and the closure date is between 01/01/2020 and 31/01/2020 then count that row. 

 

My data table has a reference id, created date and closed date.  This is linked to my date table via a 1 to many relationships from the calendar date to the data creation date. 

 

I've tried a few DAX measure but the count isn't right, I think it's due to the date relationship.  I can't remove that relation as its being used for other measures. 

 

Can anyone help?

 

thanks

 

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, Try below

 

Measure = CALCULATE(COUNT(Reference[ReferenceID]), FILTER(Reference, MONTH(Reference[Created_Date]) = MONTH(Reference[Closed_Date]) && YEAR(Reference[Created_Date]) = YEAR(Reference[Closed_Date])))
 
 

sample.PNG

 

 

Did I answer your question? If Yes, Give me a Kudo

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, Try below

 

Measure = CALCULATE(COUNT(Reference[ReferenceID]), FILTER(Reference, MONTH(Reference[Created_Date]) = MONTH(Reference[Closed_Date]) && YEAR(Reference[Created_Date]) = YEAR(Reference[Closed_Date])))
 
 

sample.PNG

 

 

Did I answer your question? If Yes, Give me a Kudo

View solution in original post

Super User IV
Super User IV

First, sample data would help. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Second, see if Open Tickets helps: https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/td-p/409364


---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors