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
kiranrcse
Frequent Visitor

dax - how to count open tickets

For the same sample data, is there a way to get this output. I am looking for Total Active tickets during that month.

Expected report output:

 Total ActiveOpenedClosed
Jan220
Feb312
Mar210
Apr530
May612

Sample Data:

SROpened dateClosed Date
T11-Jan-16 
T21-Jan-161-Feb-16
T32-Feb-164-Feb-16
T43-Mar-16 
T54-Apr-16 
T64-Apr-16 
T74-Apr-161-May-16
T81-May-168-May-16

 

Thanks in Advance,

Kiran.

1 ACCEPTED SOLUTION

Thanks @v-shex-msft. I made a small change to the code snippet you provided and it worked excellent. 

I changed this :

Sheet1[Closed Date].[MonthNo]>=EARLIER([Month])
Summary Table = 
SELECTCOLUMNS(
    ADDCOLUMNS(FILTER(DISTINCT(SELECTCOLUMNS(UNION(VALUES(Sheet1[Closed Date].[MonthNo]),VALUES(Sheet1[Opened date].[MonthNo])),"Month",[Closed Date].[MonthNo])),[Month]<>BLANK()),
        "Open",COUNTAX(FILTER(ALL(Sheet1),[Opened date].[MonthNo]=EARLIER([Month])||AND([Opened date].[MonthNo]=EARLIER([Month]),Sheet1[Closed Date]>MAX(Sheet1[Opened date]))),[SR]),
        "Close",COUNTAX(FILTER(ALL(Sheet1),[Closed Date].[MonthNo]=EARLIER([Month])),[SR]),
        "Total",COUNTAX(FILTER(ALL(Sheet1),Sheet1[Opened date].[MonthNo]<=EARLIER([Month])&&OR(Sheet1[Closed Date].[MonthNo]>=EARLIER([Month]),Sheet1[Closed Date]=BLANK())),[SR])),
                "Month",FORMAT(DATE(2016,[Month],1),"MMMM"),
                "Close",if([Close]>0,[Close],0),
                "Open",if([Open]>0,[Open],0),
                "Total",if([Total]>0,[Total],0))

  

View solution in original post

22 REPLIES 22

hello @kiranrcse,

 

can you help me with a .pbix example of what you've done?

I have some trouble understanding how to adapt the code to my data 

 

 

https://community.powerbi.com/t5/Desktop/Calculate-the-remaining-tasks-and-percentage-of-the-complet...

 

kind regards

 

 

You also find a very nice solution to that problem here (especially if you run into performance problems): http://www.sqlbi.com/articles/analyzing-events-with-a-duration-in-dax/

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

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.