Forum Discussion
Calculate overlapping shift start
- 4 years ago
Hi raicardi ,
Approve with MahyarTF .
Here is my solution:
You can create index column in Power Query:
Here is the M code:
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJS0lEytLC01DU00jU2UDAwtzIwACJUUUNTqGisDi6NhsZWxpgajQyhohCNRuTaiE0jUTYak2sjNo2EbIwFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Work Date" = _t, #"In Time" = _t, #"Out Time" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Work Date", type date}, {"In Time", type datetime}, {"Out Time", type datetime}}), #"Added Index" = Table.AddIndexColumn(#"Changed Type", "Index", 1, 1, Int64.Type) in #"Added Index"Then create and apply the measure:
Measure = var _a = MAX('Table'[Index]) var _b = FILTER(ALL('Table'),[Index]=_a-1) return IF( MAXX(_b,'Table'[Work Date])=MAX('Table'[Work Date]), SWITCH(TRUE(), MAXX(_b,[Out Time])=MAX('Table'[In Time]),"follow", MAXX(_b,[Out Time])>MAX('Table'[In Time]),"OVERLAP", "After"),"---")Output:
Kind Regards,
Bubble
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
This is my result :
thanks. Still not sure what the issue is. I've included the entire data set with all 20 groups, each with their own corresponding index. Hoping this is my issue..
- MahyarTF4 years agoMemorable Member
I hope so,
Please Kudos my posts, if those are help you
- raicardi4 years agoFrequent Visitor
Do you think it's related to multiple indexes? If you could take a look at the data link below that would be amazing.
https://docs.google.com/spreadsheets/d/162cWchQU-t_Gc7o4wgUH4WXyzCa1Dhq4J3BLDjHbMZg/edit?usp=sharing
- MahyarTF4 years agoMemorable Member
I think so, please use my dax for creating the Index column