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.
Hi all,
I'vre tried to search but all examples seems not to fit my needs...
I've got two table:
CALENDAR (classical virtual table with all dates in the last 2 years)
INCIDENT_LOG ("n" rows per incident, ordered by date, with the status of the incident); these are the basics columns:
INC_NUMBER
DATE (date+time)
STATUS (usually Assigned, In Progress, Resolve, Pending, Closed)
Considering the following data in table INCIDENT_LOG (for each ticket there are only dates with a status change):
INC1;2017-10-01 11.00;Assigned
INC1;2017-10-01 13.00;In progress
INC1;2017-10-04 14.00;Closed
INC2;2017-10-02 13.00;Assigned
INC2;2017-10-02 13.00;Closed
INC3;2017-10-02 11.00;Assigned
INC3;2017-10-02 14.00;In progress
INC3;2017-10-10 11.00;Closed
I'd like to have a calculate tabel CALENDAR_BACKLOG with the snapshot at the end of day, as follows (columns DATE;INC_IN_BACKLOG):
2017-09-30;0 (no ticket)
2017-10-01;1 (INC1)
2017-10-02;2 (INC1+INC3; INC2 is not in backlog at the end of day)
2017-10-03;2 (INC1+INC3)
2017-10-04;1 (INC3; INC1 is not in backlog at the end of day)
2017-10-05;1 (INC3)
2017-10-06;1 (INC3)
2017-10-07;1 (INC3)
2017-10-08;1 (INC3)
2017-10-09;1 (INC3)
2017-10-10;0 (INC3 is not in backlog at the end of day)
Any ideas?
Thanks in advcance everybody!
Tommaso
Solved! Go to Solution.
I'm trying to reply and add the solution I've found, but all my messages go in:
Hi all,
maybe I've found a solution, also thanks to your suggestions that guided me and helped me to change my point of view on data.
Hi @tommasocitton,
Great to hear you have found the solution! Could you accept your reply as solution to close this thread?
Regards
Of course!
Thanks for the support you gave me! 🙂
Tommaso
ciao @v-ljerr-msft
maybe I've found a next-step to think about...
What if a ticket exits and the the re-enters my backlog once more?
I mean...
Suppose the status CLOSED is not the final one and after 3-4 days, the ticket once closed is then re-opened...
The "table" SUMMARIZE only considers min and max dates in the whole life cycle of the ticket, doens't it?
🙂
Tom
Hi @tommasocitton,
Based on my test, you should be able to use the formula below to add a new calculate column in your CALENDAR table to calculate INC_IN_BACKLOG in your scenario.
INC_IN_BACKLOG = COUNTROWS ( FILTER ( SUMMARIZE ( INCIDENT_LOG, INCIDENT_LOG[INC_NUMBER], "First_Date", CALCULATE ( MIN ( INCIDENT_LOG[DATE] ) ), "Last_Date", VAR maxDate = CALCULATE ( MAX ( INCIDENT_LOG[DATE] ) ) VAR lastStatus = CALCULATE ( LASTNONBLANK( INCIDENT_LOG[STATUS], 1 ), INCIDENT_LOG[DATE] = maxDate ) RETURN IF ( lastStatus = "Closed", maxDate - 1, maxDate ) ), DATEVALUE([First_Date]) <= 'CALENDAR'[Date] && DATEVALUE([Last_Date]) >= 'CALENDAR'[Date] ) ) + 0
Here is the sample pbix file for your reference.
Regards
It seems to work.
I'm working on it to adapt to other filters I need, but you could have suggested me the right way to sort the problem out.
I'll keep back with my news asap.
Thanks again!!
Tommaso
what is your datasource with tommasocitton solution should work., have you tried creating a calculated table too, filtering everying but closed cases?
Hi emadrigal.
I'm not so sure to understand what you mean.
Considering I'm quite a newbie in DAX, off course I suppose I can create a calculated table and filter it, but I'm not able to realize it in mind first.
I mean... the output should just be another table with the count per day of all tickets for which the last status (for date <= on observation date) is <> Closed. I've tried to make an example in sql-style.
you need to create a calculated column using the calculate formula using a filter there., here is an example:
you could have this column on the calendar table or a new one because you want to count items per day.
Column = CALCULATE(COUNT(item[itemId]]),status <> 'closed')
Just to give an example, if it was a database I would have create a query like that:
select
DATE, (
select count(distinct INCDENT_NUMBER) from INCIDENT_LOG B
where B.STATUS <> 'Closed'
and B.DATE = (
select max(DATE) from INCIDENT_LOG C
where C.INCIDEN_NUMBER = B.INCIDENT_NUMBER
and C.DATE <= A.DATE
)
) as count_of_inc_in_backlog_at_date
from CALENDAR A
CALENDAR is the main table and for each date it counts the number of ticket for which the last status at that date is not closed.
I hope it helps.
Tommaso
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |