Forum Discussion

BM4291's avatar
BM4291
Resolver I
7 years ago
Solved

Ignoring Relationships

Hi,

 

Having a bit of difficulty nailing down a formula and hoping for some help.

 

I have three tables in a relationship:

 

Case - Represents a case of work

Report - Represents reports associate with cases

Date - Date Dim

 

I'm trying to show how many reports have been completed on each closed case and continually falling short.

 

My data looks like the below; Date is a standard date dimension with multiple columns i.e. Date and MonthYear (MMM-YY). Case links to Report and Date with active relationships; Report links to date with inactive relationships.

 

Case

 

IDOpenCaseClosureDate
123 22/01/2019
4561 
789 24/01/2019

 

Report

IDCaseIDCompletedCompletedDate
1123101/01/2019
2123105/04/2012
3123103/01/2019
4456104/01/2019
5456  
6789101/01/2019

 

According to the above, I know that 2 cases closed in Jan-19; I can prove this with

CasesCount = DISTINCTCOUNT('Case'[ID])
closedCases = CALCULATE([CasesCount], ISBLANK('Case'[OpenCase]))

 

I then want to find the number of reports associated with that case; I don't care when they were completed, I just need to know that they exist on that specific case.

 

When I look at the case level I get the right answer but once a date value is brought in, the figures are wrong and I'm shown closed cases (correct) but reports filed in that period (incorrect), my question is how can I ignore any date relationships with Reports and show a count of reports for all cases closed in that period.

 

I would expect to see something like the below but instead I'm seeing 3 reports because one of those was completed in a different month.

 

MonthYearCases ClosedReports
Jan-1924

 

Most recently I've tried this but returning blank; I'm trying to say return the count of reports for any cases that closed during the time period.

start = MIN(Dates[Date])
end = MAX(Dates[Date])
reports = DISTINCTCOUNT(Reports[ID]) closedCasesReports = CALCULATE([reports], FILTER('Case', 'Case'[ClosureDate] >= [start] && 'Case'[ClosureDate] <= [end] ) )

I've tried quite a lot of iterations with varying success but it appears that whenever the date is brought into the equation results return incorrectly... Can I ignore a date relationship altogether?

 

Any help greatly appreciated.

  • BM4291 here is updated pbix, added another case without report and showing some calculations, not sure if that is what you are looking for.

10 Replies

  • BM4291 not sure why you are getting different count since relationship between reports and calendar dimension is inactive. I just put together the solution based on your data and everything looks ok to me. see attached.

     

    • BM4291's avatar
      BM4291
      Resolver I

      parry2k I think I may have complicated things a bit for myself and then gone in a bit too deep... Have reverted back to something similar to what you're using (my actual solution is a bit more complext but can't share org. data).

       

      If all works as expected, will flag as solution.

      • BM4291's avatar
        BM4291
        Resolver I

        parry2k - Yes, I was definitely overcomplicating... This gets me my base measure.

         

        The next challenge was pointing out where a case has atleast one report but keep coming unstuck or getting blank values... Any suggestions.

         

        I've tried a few variations of CALCULATE and FILTER but the results are coming back far too high; is it because I need to repeat all of the additional conditions I have?