Flats sum by Flat-Type and Levels into a shared parameter

I’m working on this script that is summing room areas of the flats on a specific level.
I want to send back the summed values into the room parameter “Area Wohnungen” with flat-number as key values.

I’m almost there but the Element.SetParamenterByName is giving me this error:

Warning: Element.SetParameterByName operation failed.
The best overloaded method match for ‘Revit.Elements.InternalUtilities.ElementUtils.SetParameterValue(Autodesk.Revit.DB.Parameter, double)’ has some invalid Arguments

Any suggestions?

p.s.: just for my curiosity: is there a better or more elegant method for the group IF “Name”=Balkon THEN “Area”/2 ?

Thank you in Advance,
and have a nice Dynamoday