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

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.

Reply
sagivh
Employee
Employee

Aggregate text events with time difference

Hello, I am trying to aggregate events and cannot find the right method to do so.

 

I have a data similar to this, its basiclaly a list of events with either error or succcess, a timestamp and a unique user id. 

 

DateUserEvent
1-JanAfailure
1-JanCfailure
3-JanAsuccess
3-JanCfailure
4-JanBfailure
4-JanBfailure
7-JanCsuccess

 

 

I am looking for a way to be able to agregate this to something of the following:

show the final resault, if the final event is success or falure, and show the time between the failures to the final success but only if it ended with success (if all failures, no time or specific value). 

 

Userfinaldiff
ASuccess2 days
BFail 
CSuccess6 days

 

Is that possible?

 

Thanks. 

1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

Hi @sagivh 

try new table

Table = ADDCOLUMNS(summarize('Query';'Query'[User];"Lastevent";LASTNONBLANK('Query'[Event];1);"LastDate";LASTNONBLANK('Query'[Date];1));"diff";if([Lastevent]="success";DATEDIFF(FIRSTNONBLANK('Query'[Date];1);[LastDate];DAY);0))

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

3 REPLIES 3
parry2k
Super User
Super User

@sagivh is there always going to be one success for each user? or there can be multiple failures and successes for each user? Measure is going to be based on that.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

az38
Community Champion
Community Champion

Hi @sagivh 

try new table

Table = ADDCOLUMNS(summarize('Query';'Query'[User];"Lastevent";LASTNONBLANK('Query'[Event];1);"LastDate";LASTNONBLANK('Query'[Date];1));"diff";if([Lastevent]="success";DATEDIFF(FIRSTNONBLANK('Query'[Date];1);[LastDate];DAY);0))

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Thank you so much az38! this worked. its pretty amazing to see this kind of smart query. 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.