- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

DateDiff Function between changing variables
I am trying to calculate the time difference between conditions.
The workflow is as follows, there is a job created (Prim_ID_Fk) and everytime the job process changes it writes to a track table that adds the Prim_ID_FK as the job, it adds a new process description and a time stamp when the job changed.
Is there a way to show per job the chagne from the old to the new job description and the time difference from when it was updated?
There is 11 Job processes:
Despatch, Prewash, Strip, Assesment, Quote, Go_Ahead, Wash, Assembly, Test, Spray, Despatch/Deliver
These description can exist in any combination
I would like to show:
Prim_ID_FK | Process (Last) | Process (New) | Time |
1 Despatch Test 02:10
1 Test PreWash 01:15
1 PreWash Spray 00:25
2 Despatch Prewash 00:45
.......
DIFF =
VAR Current_Job=LASTNONBLANK(aas_wf_track_tbl[Prim_ID_FK],[Prim_ID_FK])
VAR Current_Date=MAX(aas_wf_track_tbl[Track_Date])
VAR Current_State=LASTNONBLANK(aas_wf_track_tbl[Process_Description],[Process_Description])
VAR Min_Date=SWITCH(Current_State,"Despatch", Current_Date,"Despatch",MAXX(FILTER(ALL(aas_wf_track_tbl),
[Prim_ID_FK]=Current_Job&&[Track_Date]<Current_Date),[Track_Date]))
VAR Max_Date=SWITCH(Current_State,"Despatch",MINX(FILTER(ALL(aas_wf_track_tbl),
[Prim_ID_FK]=Current_Job&&[Track_Date]<Current_Date),[Track_Date]),"Test",Current_Date)
RETURN
DATEDIFF(Min_Date,Max_Date,MINUTE)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395...
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

do these processes only ever travel from left to right ? or can they move backwards etc ? also Is this in a table, I have a soultion for this in Query Editor that we used for field status.
Thanks
Dobby
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

It can go left to right the order can change, thinkt hat is the one thing that makes it more difficult because of the permutations, it can also skip a stage.

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
05-03-2024 01:41 AM | |||
11-04-2024 12:36 PM | |||
12-12-2024 01:35 PM | |||
11-07-2024 01:47 AM | |||
08-23-2024 03:33 PM |
User | Count |
---|---|
125 | |
103 | |
84 | |
49 | |
46 |