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
FVal
Helper I
Helper I

All tickets created in a month, that was resolved in the same months

Hi,

 

Could one please help with creating a report based on two fields, Created Date and Resolved Date, that would show per month, how many tickets created in a month was resolved in that month?

 

 

The  report should display data like:

I have a report showing how many tickets were created each month, ex.:

January -100 tickets

February - 150 tickets

March - 200 tickets

 

I would need to have another, to show how many of those were resolved, but not how many were resolved in total, each month, only the onese that were also created within each month.

January - 30 tickets resolved (from that 100)

February - 120 tickets (from that 150)

March - 180 tickets (from that 200)

 

Thanks,

 

1 ACCEPTED SOLUTION

Hi @FVal ,

Please update the formula as below:

Val_ClosedIncurrentMonth =
VAR a =
    MONTH (
        FIRSTNONBLANK ( 'All_tickets_from_Fresh_API_Analytics'[Created Date], TRUE () )
    )
VAR b =
    CALCULATE (
        DISTINCTCOUNT ( 'All_tickets_from_Fresh_API_Analytics'[ ID] ),
        FILTER (
            'All_tickets_from_Fresh_API_Analytics',
            MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Created Date] )
                MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Resolved Date] )
                && MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Created Date] ) = a
        )
    )
RETURN
    b

If the above measure still can't get the correct result, please provide some sample data(exclude sensitive data).

 

Best Regards

Rena

Community Support Team _ Rena
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

8 REPLIES 8
v-yiruan-msft
Community Support
Community Support

Hi @FVal ,

You can create one measure as below:

ClosedIncurrentMonth =
VAR a =
    MONTH ( FIRSTNONBLANK ( 'TicketInfo'[Created Date], TRUE () ) )
VAR b =
    CALCULATE (
        COUNT ( 'TicketInfo'[Ticket number] ),
        FILTER (
            'TicketInfo',
            MONTH ( 'TicketInfo'[Created Date] ) = MONTH ( 'TicketInfo'[Resolved Date] )
                && MONTH ( 'TicketInfo'[Created Date] ) = a
        )
    )
RETURN
    b

aa.JPG

 

Best Regards

Rena

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

Hi Rena,

 

Thank you for your valuable input.

 

I did as sugested, nevertehless, I do see abit more values than it should be.

 

Ex. For a speficig group, there should be 41 Closed tickets, I checked in the application, then in the data source and 41 it's the correct number, but in the report it is displayed a total of 61 Closed tickets. 

 

Any idea where those extra ones are coming or how to filter it so it takes only the 41 ones?

 

Below the exact Measure, based on your example:

 

Val_ClosedIncurrentMonth =
VAR a =
MONTH ( FIRSTNONBLANK ( 'All_tickets_from_Fresh_API_Analytics'[Created Date], TRUE () ) )
VAR b =
CALCULATE (
COUNT ( 'All_tickets_from_Fresh_API_Analytics'[ ID]),
FILTER (
'All_tickets_from_Fresh_API_Analytics',
MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Created Date] ) = MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Resolved Date])
&& MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Created Date] ) = a
)
)
RETURN
b

 

Regards,

Valentin

 

 

Hi @FVal ,

Please update the formula as below:

Val_ClosedIncurrentMonth =
VAR a =
    MONTH (
        FIRSTNONBLANK ( 'All_tickets_from_Fresh_API_Analytics'[Created Date], TRUE () )
    )
VAR b =
    CALCULATE (
        DISTINCTCOUNT ( 'All_tickets_from_Fresh_API_Analytics'[ ID] ),
        FILTER (
            'All_tickets_from_Fresh_API_Analytics',
            MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Created Date] )
                MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Resolved Date] )
                && MONTH ( 'All_tickets_from_Fresh_API_Analytics'[Created Date] ) = a
        )
    )
RETURN
    b

If the above measure still can't get the correct result, please provide some sample data(exclude sensitive data).

 

Best Regards

Rena

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

Hi @v-yiruan-msft,

 

Thank you for your support, the numbers are still the same even with the new measure.

 

I will have to check the source, even if the things looks fine there.

 

Could it count also rows where Closed date is empty, as there are some rows with no value there.

 

Thanks,

Val

Hi @FVal ,

Could you please provide some sample data for the following scenario in order to find the cause of getting incorrect return value? And it is better to provide your PBIX file if it is convenient. Thank you.

Ex. For a specific group, there should be 41 Closed tickets, I checked in the application, then in the data source and 41 it's the correct number, but in the report it is displayed a total of 61 Closed tickets.

 

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yiruan-msft
Community Support
Community Support

Hi @FVal ,

You can create one measure as below:

 

ClosedIncurrentMonth =
VAR a =
    MONTH ( FIRSTNONBLANK ( 'TicketInfo'[Created Date], TRUE () ) )
VAR b =
    CALCULATE (
        COUNT ( 'TicketInfo'[Ticket number] ),
        FILTER (
            'TicketInfo',
            MONTH ( 'TicketInfo'[Created Date] ) = MONTH ( 'TicketInfo'[Resolved Date] )
                && MONTH ( 'TicketInfo'[Created Date] ) = a
        )
    )
RETURN
    b

 

closedincurrentmonth.JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

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


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Tad17
Solution Sage
Solution Sage

Hey @FVal 

 

First off, make sure you have a calendar table as outlined here: https://powerbi.tips/2017/11/creating-a-dax-calendar/

 

I would create two calculated columns in your data that you can put in your visuals. The first would simply be a column with 1's to use as a "Count of tickets"

 

Count of Tickets = 1

 

Then you can create another column that will return "1" if the created date and resolved date are the same month:

 

Resolved in Same Month = IF(MONTH(Table[Created Date])=Month(Table[Resolved date]), 1, 0)

 

This will put a 1 in the column for each row where the created and resolved date share a month. If your data ranges over multiple years it will need to be:

 

IF(AND(MONTH(Table[Created Date])=Month(Table[Resolved date]),YEAR(Table[Created Date])=YEAR(Table[Resolved date]), 1, 0)

 

If this helps please kudo.

If this solves your problem please accept it as a solution.

 

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.