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
Anonymous
Not applicable

Power BI open tickets beginning of the month, including year, category and prioirty

Hello,

 

I am trying to calculate the open tickets at the beginning of the month for the whole history of a data set that I have (data is available since 2017), including a category and a priority. The data set would look as follows (as an example):

 

IDcreationDateclosureDateclosedPriorityCategory
1234504-01-201906-04-2019TrueLowCategory A
2345604-03-2019 FalseHighCategory B
3456719-02-201920-02-2019TrueMediumCategory B
4567821-02-201902-03-2019TrueLowCategory A


What I would like to get of out of this is (where primo is the number of tickets still open at the beginnen of the month):

 

DateOpenClosedPrimoPriorityCategory
jan-19100LowCategory A
feb-19101LowCategory A
feb-19110MediumCategory B
mrt-19100HighCategory B
mrt-19012LowCategory A
apr-19001HighCategory B
apr-19011LowCategory A


So far I tried the following formula:

 

 

Open beginning month = 
SELECTCOLUMNS(
    ADDCOLUMNS(FILTER(DISTINCT(SELECTCOLUMNS(UNION(VALUES(Incidents[closureDate].[MonthNo]);VALUES(Incidents[creationDate].[MonthNo]));"Month";[closureDate].[MonthNo]));[Month]<>BLANK());
        "Open";COUNTAX(FILTER(ALL(Incidents);[creationDate].[MonthNo]=EARLIER([Month])||AND(Incidents[creationDate].[MonthNo]=EARLIER([Month]);Incidents[closureDate]>MAX(Incidents[creationDate])));[id]);
        "Close";COUNTAX(FILTER(ALL(Incidents);Incidents[closureDate].[MonthNo]=EARLIER([Month]));[id]);
        "Primo";COUNTAX(FILTER(ALL(Incidents);Incidents[creationDate].[MonthNo]<=EARLIER([Month])&&OR(Incidents[closureDate].[MonthNo]>=EARLIER([Month]);Incidents[closureDate]=BLANK()));[id]));
                "Month";FORMAT(DATE(2019;[Month];1);"MMMM");
                "Close";if([Close]>0;[Close];0);
                "Open";if([Open]>0;[Open];0);
                "Primo";if([Primo]>0;[Primo];0))

 

 

However, this calculates only the number of tickets at the beginning of the month over the last couple of years, instead of for example Jan 2019, Feb 2019, etc.

 

Knipsela.PNG

 

Is there anyone that can help me with creating the correct formula?

 

Thank you.

2 REPLIES 2
Anonymous
Not applicable

Hi crloef,

 

I am not 100% certain, but i think the result you are getting is based on purely month number, it does not condsider the year. I would suspect to achieve your desired result, you need to 'supply' the dates (first of the month) you are working with. Do you have a seperate Date table? if so, include a calculated column there, First of Month. With that in place (and a relationship set up) each of your creation and closure dates would have a First of Month relationship and so you could use that First of Month in your formula. 

Anonymous
Not applicable

Yes I have a seperate dates table, including only the first of the month. However, how would I put that in my formula then?

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.