this is calculation view in db folder
srv folder code
How to build services which contains aggregate based entities in sap cap odata v4 ?
What are the annotations required to make an entity aggregated ?