Create a helper entity (let’s call this AgeCalculator) with DateTime attribute DateOfBirth and show it in a data view. Add a datetime picker widget to select your date of birth. Trigger a microflow using an on change event on the datetime picker. In that microflow you can calculate your age by using the between date function call “calendarYearsBetween” where you put in CurrentDateTime and DateOfBirth:
Create a button with a microflow and use the community commons YearsBetween function to calculate the years between the Date of birth and the current date.
As Ronald said, you can use calendaryearsbetween function,
You can get to know about it in the document from the link below,
Hope it helps!