You're losing the value after the decimal point in the following calculation, so the result ends up being 0. (That's what happens when you divide integers and longs instead of decimals and doubles.)
(inUse / 1024 / 1024)
Either change the integers to decimals to retain the decimal portion of the result:
(inUse / 1024m / 1024m)
Or change those first five variables in your code snippet so they're all decimal type, and then you can leave 1024 as is:
decimal phav = PerformanceInfo.GetPhysicalAvailableMemoryInMiB();
decimal tot = PerformanceInfo.GetTotalMemoryInMiB();
decimal percentFree = ((decimal)phav / (decimal)tot) * 100;
decimal percentOccupied = 100 - percentFree;
decimal inUse = tot - phav;