Forum Discussion
Anonymous
4 years agoNot applicable
Need Help Running Index that Resets
Running Index that Resets based on criteria Hello i need help with this I have a Table with many variables, that have Values, this value are evaluated as Status 1 or 0 where 0 = Ok, and 1 is O...
wdx223_Daniel
4 years agoCommunity Champion
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSkwqysxR0lEyNgASBlYGIMoxOTMltUohNU/B383H0QgoYmhkDCKB2EwpVgdNlwlZuixw6jI2x63L0Ai3ZYZ4tJnh1maKW5sRngCxQNGWm1iZDxUgOhCR9OAJQktcenAHIG63GaJq8ndT8DQyAIsYGmDTAzbOAJceI5xaTEjXgttluLQYGZGkBRT4pOswI8InsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [MONTH = _t, DAY = _t, HOUR = _t, #" VARIABLE" = _t, VALUE = _t, STATUS = _t, CRITERIA = _t]),
Custom1 = Table.TransformColumns(Source,{{"STATUS",Number.From},{"CRITERIA",Number.From}}),
Custom2 = #table(Table.ColumnNames(Source)&{"COUNTER","ANOMALY ANALYSIS"},List.Accumulate(Table.ToRows(Custom1),{},(x,y)=>let a=List.Last(x,{}) in if y{3}=a{3}? then x&{y&{a{7}+1??1,if a{7}+1=y{6} then "IA" else null}} else x&{y&{if y{5}=0 then null else 1,null}}))
in
Custom2