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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
sandip
Helper III
Helper III

How to count tickets carrying over the month

Hi,

I need to calculate count tickets carrying over the month and below is the data set link:

https://drive.google.com/file/d/1zOPAPGx1ovtF4IdM80Li2WqCkjDYku7a/view?usp=sharing

and below is the data set look like:

TicketDate CreatedDate Closed
11-Jan31-Jan
21-Jan1-Feb
315-Mar1-Jun
431-May1-Jun
58-Feb1-Apr
61-May15-May
731-Jan1-Jun
815-Jun18-Jun
91-Mar1-May
101-Jan2-Jan

 

I have done a sample PBIX file for it, but it does not calculate correctly and below is the link of the report:

https://drive.google.com/file/d/1mo4iqptANkFQ3vr4nV2ASxdNLqMjzwzV/view?usp=sharing

 

so the count should look likie this:

MonthCount of In Progress
Jan4
Feb3
March4
April4
May5
June4

 

I am using the below expression:

Carryover Tickets1 =
VAR __mindate = MIN ( 'Calendar'[Date] )
VAR _maxdate = MAX( 'Calendar'[Date] )
RETURN
CALCULATE (
DISTINCTCOUNT( 'Demo Data'[Ticket ] ),
'Demo Data'[Date Created] <= __mindate,
'Demo Data'[Date Closed] >= __mindate || ISBLANK('Demo Data'[Date Closed] )
)
and I am getting below result which is wrong:
Month-YearCarryover Tickets1
20-Apr4
20-Feb2
20-Jan3
20-Jun3
20-Mar3
20-May4

can any one help me how to correct the expression?

 

 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @sandip 

Create measure

Measure =
VAR min1 =
    MIN ( 'Calendar'[Date] )
VAR max1 =
    MAX ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Demo Data'[Ticket ] ),
        FILTER (
            'Demo Data',
            max1 >= [Date Created]
                && ( max1 <= [Date Closed]
                || min1 <= [Date Closed] )
        )
    )

Capture5.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @sandip 

Create measure

Measure =
VAR min1 =
    MIN ( 'Calendar'[Date] )
VAR max1 =
    MAX ( 'Calendar'[Date] )
RETURN
    CALCULATE (
        DISTINCTCOUNT ( 'Demo Data'[Ticket ] ),
        FILTER (
            'Demo Data',
            max1 >= [Date Created]
                && ( max1 <= [Date Closed]
                || min1 <= [Date Closed] )
        )
    )

Capture5.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

Thank you for your solution. It looks like you have that PBIX file with the propoer solution, can I have it or can you attach it at this forum so that I can go though it?

 

Thanks,

Sandip

Hi @sandip 

Here.

 

Best Regards

Maggie

Hi,

I have shared a PBIX file , Can you please check what I have wrong there?

I really need this help. Aslo If an employee terminated at the same month of joining, then your below expression will not work and I have tested it:

 

Current Employees = CALCULATE(COUNTx(FILTER(Employee,Employee[Date Created]<=max('Date'[Date]) && (ISBLANK(Employee[Date Closed]) || Employee[Date Closed]>max('Date'[Date]))),(Employee[Ticket])),CROSSFILTER(Employee[Date Created],'Date'[Date],None))

Below is the data set for reference:

Start DateEnd DateEmployee  Id 
1/1/2015 0:001/28/2015 0:001
1/1/2015 0:001/21/2015 0:002
2/10/2015 0:0012/31/2015 0:003

 

So can you please give correct expression which will consider the employee number who has resigned at the same month of joining?

 

Thanks,

Sandip

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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