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.
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.
Date | User | Event |
1-Jan | A | failure |
1-Jan | C | failure |
3-Jan | A | success |
3-Jan | C | failure |
4-Jan | B | failure |
4-Jan | B | failure |
7-Jan | C | success |
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).
User | final | diff |
A | Success | 2 days |
B | Fail | |
C | Success | 6 days |
Is that possible?
Thanks.
Solved! Go to Solution.
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
@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.
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
Thank you so much az38! this worked. its pretty amazing to see this kind of smart query.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
83 | |
70 | |
61 |
User | Count |
---|---|
149 | |
114 | |
107 | |
89 | |
67 |