Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Display the last entry to a log based on a ticket ID and a Key ID

Hello Power BI community,

I hope someone can help.

 

I have a table with some log data for a ticket system, the log data has several fields with a key_id, and a date time stamp. I'm trying to dispaly in a visual the last entry based on the ticket id and the key id of the field completed. Any ideas are welcome. 

 

Thank you

Miguel

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

You can create a table visual with all fields you needed, then use following measure on visual level filter to filter matched records:

measure =
VAR _lastDate =
    CALCULATE (
        MAX ( Table[Datetime] ),
        ALLSELECTED ( Table ),
        VALUES ( Table[Ticket ID] ),
        VALUES ( Table[key ID] )
    )
VAR _currDate =
    MAX ( Table[Datetime] )
RETURN
    IF ( _currDate = _lastDate, "Y", "N" )

If above not help, please share some sample data for test, it is hard to coding formula without any detail information.

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Hello @v-shex-msft ,

 

First of all thank you for your prompt reply and sorry for not answering earlier, I was out on a business trip and had limited access to email and computer.

 

What you suggested only gives me a Y or N value on the visual. I'm looking to show a value from the table, let me share some content to better explain.

From below table I am looking to display the last entry for each combination of Ticket_ID & Key_ID, based on the Ticket_ID.

So for ticekt_id 20063, I want to display the value for Key_ID 52 that has the last entry that is the value for row with id of 94952, and for the same ticket_id the value for key_id 53 with the last entry which is in row with id 94953. In the same maner I want to show for ticket_id 20066 and key_id 52 the value  for the row with ID 94618, which is the last entry done, and so on with the entries in red and underlined below.

 

idjournal_idKey_IDvalueTicket_IDcreated_on
926644625752Last interface to be migrated200636/11/19 15:56
926654625753Checking if all teams are ready for migration.200636/11/19 15:56
917194580253Continue to monitor progress of migration.200636/4/19 15:09
949534733353Next step depends on outcome of migration.200636/25/19 16:28
949524733352Migration failed200636/25/19 16:28
917184580252New migration date is 6/20/19.200636/4/19 15:09
920444596952No updates this week200666/6/19 13:10
935944668952No updates this week200666/18/19 11:16
946184716052No updates this week200666/25/19 10:08
913874567752Checking for the applicable solution to phase out equipment201846/3/19 19:46
922874609152Team checked but unable to confirm an applicable solution to phase out Equipment201846/10/19 18:19
934124661252Team checked but unable to confirm an applicable solution to phase out Equipment201846/17/19 19:30
945484712452Equipment has been phased out successfully201846/24/19 23:05
965054805452Equipment has been phased out successfully201847/8/19 21:55
885974421653Awaiting feedback from investigation201845/14/19 21:55
905624526753Awaiting feedback from investigation201845/28/19 13:54
913884567753Awaiting feedback from investigation201846/3/19 19:46
922884609153Await for further guides from subject mater expert201846/10/19 18:19
934134661253Await for further guides from subject mater expert or manager201846/17/19 19:30
945494712453Await for guidelines for follow-up cleanup201846/24/19 23:05
957064768353Await for guidelines for follow-up cleanup201847/2/19 0:11
965064805453Clean up Completed201847/8/19 21:55

 

Thank you for your prompt reply.

HI @Anonymous ,

You can use following calculated column formula to mark last date based on 'key id' and 'ticket id', then you can add filter on new column to display last date:

IsLast =
IF (
    [created_on]
        = CALCULATE (
            MAX ( Table1[created_on] ),
            FILTER (
                ALL ( Table1 ),
                [Ticket_ID] = EARLIER ( Table1[Ticket_ID] )
                    && [Key_ID] = EARLIER ( Table1[Key_ID] )
            )
        ),
    "Y"
)

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.