Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
09-18-2020 09:55 AM - last edited 09-22-2020 16:53 PM
OK, this one counts cycles as devices move through different states. In this case, each time a device hits the "1" state, the cycle count increases per device. It is computationally intensive.
Cycles Count =
VAR __BaseTable = ALL('Table')
VAR __device = MAX([device])
VAR __Index = MAX([Index])
VAR __Table =
ADDCOLUMNS(
ADDCOLUMNS(
ADDCOLUMNS(
FILTER(ALL('Table'),[device]=__device && [index]<=__Index),
"__Previous",MAXX(FILTER(__BaseTable,[device]=EARLIER([device]) && [Index]<EARLIER([Index])),[Index])
),
"__PreviousState",MAXX(FILTER(__BaseTable,[Index]=[__Previous]),[State])
),
"__CycleChange",IF(([State]=1 && [__PreviousState]<>1),1,0)
)
RETURN
SUMX(__Table,[__CycleChange])
eyJrIjoiY2RlZDRhNGMtYWMwMi00NzRiLWI4MjktY2JlZTc4Nzg4Yjc2IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9