Hi Nuno,
when your data is already boolean you can use simple boolean operations to detect state transitions:
false -> true: NOT(sample(n-1)) AND sample(n)
true -> false: sample(n-1) AND NOT(sample(n))
You can use the 'Compound Arithmetic' function found in the boolean palette. To do the NOT-operation you can invert the appropriate inputs (and output too, if needed).
See the attached example!
Best regards,
GerdW

using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019