I want to do dynamically,I want to write the logic in script level which means,the productId is linked to transaction table. so that in the future they will change the factovalue for that perticular productid it will efect to my reports with giving any calculation in reports.
If these are not helping you, it would help us to understand if you add some informations. For example, try giving some sample lines of data describing your data model and your expected outcome (like a new field in the data model or a column in a chart (but then please describe also the dimensions you want to use).
You can add these informations for example as INLINE tables (QV script snippets using an LOAD * INLINE [.. ] format) or excel tables or at best a small QV .qvw file demonstrating your issue.