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.
Hi Everyone - am facing hardships in calculating timestamp difference based on conditions. My data looks like below;
Now i want to see these as below;
1) Filter rows based on 'Earliest time and date' from a given workitem so that we get 1 row for 'Active' (earliest date and time) and 'Pending' (earliest date and time)
2) then calculate difference: Earliest Pending date & time - Earliest Active date & time
Is it possible to get this done in DAX?
@amitchandak @parry2k @Zubair_Muhammad @Felix
Solved! Go to Solution.
Hi @navedkhan
Kindly check my below results:
Measure = CALCULATE(MIN('Table'[Date&Time]),ALLEXCEPT('Table','Table'[Workitem no. ],'Table'[Status]))
Measure 2 = var a = MINX(FILTER(ALL('Table'),[Workitem no. ]=MAX('Table'[Workitem no. ])&&[Status]="Pending"),[Measure])
Return
ABS(DATEDIFF(a,[Measure],HOUR))
Pbix attached.
Hi,
If you question is still unanswered, then share the link from where i can download your PBI file.
Hi @navedkhan
Kindly check my below results:
Measure = CALCULATE(MIN('Table'[Date&Time]),ALLEXCEPT('Table','Table'[Workitem no. ],'Table'[Status]))
Measure 2 = var a = MINX(FILTER(ALL('Table'),[Workitem no. ]=MAX('Table'[Workitem no. ])&&[Status]="Pending"),[Measure])
Return
ABS(DATEDIFF(a,[Measure],HOUR))
Pbix attached.
@navedkhan , Try like
if([Status] ="Pending" ,maxx(filter(table,[workiten_no] =earlier([workiten_no]) && [Status] ="Active"),[Date & time])
minx(filter(table,[workiten_no] =earlier([workiten_no]) && [Status] ="Pending"),[Date & time]),blank())
could you pls help suggest with a workable solution? Am waiting to put it into production.
No it doesn't work as expected. it gives me wrong date&time values.
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 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |