Forum Discussion

trb7fh's avatar
trb7fh
Frequent Visitor
2 years ago
Solved

Point in Time Comparison

Hello,

 

I've searched the forums for a while and can't find anything that seems to be a match to what I'm doing, but maybe I'm not searching for the right thing.

 

I'm needing to build a visual that will show a count how many open incidents we have on the first of the month for the last 12 months. Open being defined as CREATEDDATE is equal to or before the as-of-date (the 1st of the corresponding month), and RESOLVEDDATE is after the as-of-date or null. If possible, we'd like to count anything with a status of "Reopened" as Open, despite the RESOLVEDDATE showing an earlier value, but these tickets are few enough I believe we can manage without if needed. We'd also like a separate count of the number of tickets Open as of today.

 

I've attached a sample of the (scrubbed) data, which is imported from our database. The table name is CHERWELL_INCIDENT_TRACKING, and it's the only table I have on the report. I don't have any date tables or other items in modeling. Note we are looking for a distinct count, but INCIDENTID is our primary key with each incident having its own row and listed once.

 

Thank you in advance for the help! I know how to build this in my old software but still very new to Power BI.

 

INCIDENTIDCREATEDDATESTATUSLASTMODIFIEDDATERESOLVEDDATEESCALATED
92832810/24/2021Assigned2/18/2022nullYes
93152810/27/2021Assigned4/13/2023nullNo
93153210/27/2021Assigned4/13/2023nullNo
93153610/27/2021Assigned4/13/2023nullNo
92419310/19/2021Assigned10/19/2021nullYes
93245310/27/2021Assigned4/13/2023nullNo
1726810/1/2018Closed5/29/20235/18/2023No
1918510/2/2018Closed9/26/20229/16/2022No
1918710/2/2018Closed10/3/20229/22/2022No
5010011/19/2018Closed10/6/20229/26/2022No
5289911/27/2018Closed8/10/20237/31/2023Yes
1774336/7/2019In Progress3/22/2021nullYes
1864546/19/2019In Progress8/29/2023nullNo
2074787/18/2019In Progress3/22/2021nullYes
92351510/18/2021New10/18/2021nullNo
1346114/8/2019Pending2/23/2022nullYes
1616305/20/2019Pending3/22/2021nullYes
31274011/13/2019Pending8/22/2023nullNo
4195553/26/2020Reopened3/22/20223/18/2022No
8103356/22/2021Reopened2/9/20222/3/2022No
8072586/16/2021Reopened2/9/20222/3/2022No
1283373/29/2019Resolved8/31/20238/31/2023No
94573411/10/2021Resolved8/25/20238/25/2023Yes
  • Hi trb7fh 

     

    I've prepared your required output in the power BI data model visualization as shown below.  In Power BI, the best practice is to utilize data model instead of combining in one table all the data.  For this type of requirement where there are two dates columns in a fact table to calculate duration, the standard way to solve is to use a disconnected calendar (date) dable. 

    First, I created a separate calendar table by writing the following dax table formula.  

    Additionally, I created a calculated column to distinguish the 1st date in a month and other days in the calendar table (I am sure there's a way to combine this in the table formula above, but I couldn't do it quickly, hence a calculated column was created).  

    The data model looks like below where there are no relationship between the fact table and the calendar table (it's called a disconnected table).  

    In order to express the open items with respect to the time dimension, I've written dax measure like below:

    Additionally, I've written a list of concatenatedXed ID to identify which ID are open at any particular date which can be cross filtered by the month and year matrix table visualization.  

     

    The resultant visualization is as shown below, where you can toggle between 1st day and other slicer to get beginning of the month and end of the month status.  

    I attach the pbix file link below:

    CHERWELL_INCIDENT_TRACKING.pbix

    BTW, just out of curiosity, is your old system Tableau?  

     

     

2 Replies

  • Hi trb7fh 

     

    I've prepared your required output in the power BI data model visualization as shown below.  In Power BI, the best practice is to utilize data model instead of combining in one table all the data.  For this type of requirement where there are two dates columns in a fact table to calculate duration, the standard way to solve is to use a disconnected calendar (date) dable. 

    First, I created a separate calendar table by writing the following dax table formula.  

    Additionally, I created a calculated column to distinguish the 1st date in a month and other days in the calendar table (I am sure there's a way to combine this in the table formula above, but I couldn't do it quickly, hence a calculated column was created).  

    The data model looks like below where there are no relationship between the fact table and the calendar table (it's called a disconnected table).  

    In order to express the open items with respect to the time dimension, I've written dax measure like below:

    Additionally, I've written a list of concatenatedXed ID to identify which ID are open at any particular date which can be cross filtered by the month and year matrix table visualization.  

     

    The resultant visualization is as shown below, where you can toggle between 1st day and other slicer to get beginning of the month and end of the month status.  

    I attach the pbix file link below:

    CHERWELL_INCIDENT_TRACKING.pbix

    BTW, just out of curiosity, is your old system Tableau?  

     

     

  • trb7fh's avatar
    trb7fh
    Frequent Visitor

    Hello!

     

    I sincerely appreciate the thorough response. Max Date was missed, but I was able to figure it out easily from your test file. I've also included it below in case anyone comes across this thread in the future looking for answers. Otherwise, I was able to recreate it in our file and it works perfectly! I figured a date table would be needed, since the source table was created by an outside source (and all existing in one table), but I'm not very familiar with them and had only seen them as a connected table so I wasn't sure how to go about building for this particular question.

     

    The old system from my previous job was Looker.