Hello all,
Thank you for your help. I am trying to create a calculation that has been working in an MS Access Database up to now but has become REALLY SLOW!
I am visualizing cost and count of devices for my company's wireless program. Part of the visualization is to identify devices that are not being used AKA "nonUsage"
NonUsage is defined as the a device that has no usage (voice, text, data) for the last three months.
Example:
Device 123 in Jan was 0
Device 123 in Feb was 0
Device 123 in Mar was 0
Therefore in Mar Dev 123 is considered "nonUsage"
I have created two calcs to do this that are based upon the Max Month in the dataset.
My calcs are:
Calc 1: IF [Month]>=DATEADD('month',-2,{max([Month])}) then [Usage] END
Calc 2:
IF {FIXED [Device ID],[Phone Number],[Month]:sum([!Non-Usage Calc (1)])} = 0 THEN "nonUsage"
else "In Use"
END
If I filter my viz to just show the "nonUsage" values this works.
What I am looking to do now are two things:
1. Improve what I already have
2. Modify this logic so that for any month, the logic looks back at the previous two month and sums the usage with the current month.
I have attached a sample dataset.
Months where nonUsage should be found:
Dog in Oct 2019
Cat in Dec 2019
Months where nonUsage should not be found:
Zebra in Nov 2019 becuase there was only 2 months of nonUsage.
I am working in 2018.1
Thank you,
Scott

There is a nifty function called PREVIOUS_VALUE that lets you look back and do an operation on the previous value of this calc.
See my calc [Non Usage Flag] in the attached.
In my case I made a running count of non-use rows (restart every Phone Number (within every Device ID, within every other dimension above it...).
THen I made a color calc to color the rows that have 3 or greater. (So you will also see 4 and 5 and 6,...) Notice for Dog the usage starts back up again, and my calc resets to zero there.