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.
ID | Event | time |
1 | start | 06-04-2020 15:00 |
1 | mid time | 06-04-2020 15:10 |
1 | end | 06-04-2020 15:14 |
2 | start | 06-04-2020 18:00 |
2 | mid time | 06-04-2020 18:20 |
2 | end | 06-04-2020 18:40 |
I would like to find duration of each event - so to have in table that event "1" latest 14 min and event 2 lasted 40 min
Solved! Go to Solution.
@Anonymous , Try a measure like
sumx(summarize(table, table[ID], "_1", datediff(minx(filter(table,table[Event]="start"),table[time]),maxx(filter(table,table[Event]="end"),table[time]), minute)),[_1])
Hi @Anonymous ,
Just helping you on the above solution.
You are creating a Calculated Column, while the solution is given for a measure.
Create a New Measure
Regards,
Harsh Nathani
Hi @Anonymous
kindly find my below results:
Measure = var a = MINX(FILTER(ALL('Table'),[ID]=MAX('Table'[ID])),[time ])
var b = MAXX(FILTER(ALL('Table'),[ID]=MAX('Table'[ID])),[time ])
return
DATEDIFF(a,b,MINUTE)
@Anonymous , Try a measure like
sumx(summarize(table, table[ID], "_1", datediff(minx(filter(table,table[Event]="start"),table[time]),maxx(filter(table,table[Event]="end"),table[time]), minute)),[_1])
@amitchandak Would it be possible to apply the solution as a calculated column instead of measure?
@amitchandak So this is my orginal table and I am trying to calculate timw between "All Fast" and "Pilot off". the table is called "PortStayEvents (R)" So my code looks like this:
But it doesnt work... Could you advise me what to do ?
Hi @Anonymous ,
Just helping you on the above solution.
You are creating a Calculated Column, while the solution is given for a measure.
Create a New Measure
Regards,
Harsh Nathani
Hi @amitchandak , Thank you for your suggestion. The problem is that I have 300 different IDs.. and in your solution you calculated time for only one ID - "1" right ?
@Anonymous , No, it is for everything
_1 is the name of the column in summarize table
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 |
---|---|
113 | |
100 | |
78 | |
76 | |
52 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |