Forum Discussion

DKwustl's avatar
DKwustl
New Member
3 years ago
Solved

Displaying the latest date with comment correctly

I am having issues with a tracking report I have created. The data looks like the following within the database:

 

Item TypeEvent TimeUserCommentWorkstation
Slide A1/4/23 12:37pmJaneDelieveredW340
Draft1/4/23 11:23amJanePut in drop box

W340

Slide B1/4/23 10:02Julie W503
Slide A1/4/23 10:01amJulieSent to LabW503

 

Info about the tracking system. The latest comment always appears at the time and all types are tracked under the same database table. We do not care about infomation of the user or the work station. Whether it is a slide or draft, we want the lastest comment to diplay.

 

The table visual in the report has other identifying information with joined tables. It is a direct query. It looks like the following:

Case No.StatusCase opened datePriorityLast scan status(Comment)Last Scan date(Event time)
s-1Grossing1/2/23 9:00am2Put In Mailbox1/3/23 12:00pm
s-4Complete1/1/23 9:17am1With Doctor1/3/23 2:30pm
s-34Grossing1/3/23 9:13am3Sent to Lab1/3/23 10:23am

 

So we do not want to show any blank comments so I removed blanks or null from the filter. Cases have multiple status but we only want to show the lastest status date with a comment. What I am running into is sometimes the table does not show the latest date and comment. Since the system puts the latest comment on the first row, I aggregated "Last scan status" to show the first comment and the "last scan date" to show the latest time. 

 

The gets it so that there is only one line per case on the table. If I do dont summarize, it gives all the scans on one case. We do not want that. But the case just randomly will not show the correct "last scan status" but it will show the "latest scan date." Is there a way to create a formula to display this information correctly and accurately. I have tried everything I can think of and have had no success. I checked my SQL query to just confirm there was no issues there and that was fine.

 

I appreciate the help.

  • DKwustl Maybe:

    Last scan status measure = 
      VAR __LastScanDate = MAX('Table',[Event Time])
      VAR __LastStatus = MAXX(FILTER('Table',[Event Time] = __LastScanDate),[Comment])
    RETURN
      __LastScanDate
    

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    DKwustl Maybe:

    Last scan status measure = 
      VAR __LastScanDate = MAX('Table',[Event Time])
      VAR __LastStatus = MAXX(FILTER('Table',[Event Time] = __LastScanDate),[Comment])
    RETURN
      __LastScanDate
    
    • DKwustl's avatar
      DKwustl
      New Member

      I feel like I attempted this one but let me try again just to be sure.

    • DKwustl's avatar
      DKwustl
      New Member

      I feel like this is working but I want to make sure with todays results. I still had one that did not display the correct comment. It makes me feel it could be a scanning issue.