This has been a longstanding bug that should be fixed given the release of Exalted weapon modding and the addition of new mods that impact many Warframe/melee builds.
Applying Forma to a gear item locks your "XP" statistic on your profile until you reach that value + 1 from 0 to progress this counter. What does that mean? Well here is my test to display the bug.
Here is Equinox:
Equinox applies one Forma and proceeds to level.
410,985 Affinity is earned from a mission. After returning to the ship, the profile still displays the previous value: 14,060,714. The value should be 14,060,714 + 410,985 or 14,471,699 Affinity. This is because applying Forma to any gear item resets your affinity to 0 and requires you to reach your previous affinity number before counting onward. This will end up displaying incorrect statistics as the XP value will not be showing Affinity gained in between Formas.
This does not matter whether the gear item is between level 0 and 30. This bug stays after your gear is rank 30. This is displayed in the second video below. Regardless of your gear's level, your profile affinity is reset to zero under the hood and locks your current XP statistic.
Here is a video format of the bug in question:
I bring this to light because new mods and Exalted modding may reset years worth of XP on the profile page. It would be fantastic if this was addressed, because millions or even billions of affinity could be lost due to applying Forma on aged builds.