Why use again?
Where are you using SUM twice?
What is the exact SQL code of your measure (defined in the SELECT box of Designer)?
In addition, do refrain from posting the essentially same question twice, Please do not cross-post. It leads to fragmented discussions and is against our forum rules.
This is the SQL I use in the SELECT part of Measure Object properties. User prompts forTrans_Date and on the report I should display MTD, YTD according to thedates passed by the user
MTD:-
SUM
(
CASE WHEN Trans_Date >= trunc(Trans_Date,'mm') AND Trans_Date <= Trans_Date
THEN DECODE (SKU_FLAG, 'ABC', SALE_AMOUNT, BCA', (SALE_AMOUNT)*10), 0)
ELSE 0
END
)
Since it is a Measure Object, Do I need to use SUM again in the SELECT part? In the object properties I am choosing SUM aggregate projection. So, if I use it again in the SQL it would be two times. Isn’t it?
Yes. Sum(Case …End) in a measure select statement worked.Thanks.
Dave, I have gone through your thread about Object Projection and aggregation. I did not understand it. I will read it again. Can you please give the basic difference in one line or as simple as you can?
But how to write the object SQL for the following MTD YTD Measures
Users prompt for the date range date1 and Date2.According to that I have to calculate MTD and YTD. The query in the above thread has hardcoded dates. Instead of that it has to take the user date range. There is no Object level SQL. I have not written anything yet
Aggregation happens on the database server during query execution. Projection happens on the client report during slice and dice. They are not substitutes for each other. Please also read the posts Andreas linked you to.
Thank you Dave. I will go through your blogs one more time and see if I can understand them.
I did not understand the second part of your statement: “Projection happens on the client report during slice and dice”
I think when you define SUM() in the select part, the WebI query automatically groups by while reports execution. Am I correct?
One more question for you. Can I do SUM() in the SELECT part of a Dimension object?!! Sorry, if I am acting too stupid