Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Help Required ?

Hi All,

I have a requirement like i have field Year in that i have two years.if i click on year one it should show accumulate on total and if i click on second year it should accumulate previous year and present year,so how to do in script level ?

Find bow attachment.and give me some valid examples,,,Its Urgent,,

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Please check the attached qvw. Note, here order of data load matters.

View solution in original post

4 Replies
tresesco
MVP
MVP

Please check the attached qvw. Note, here order of data load matters.

Not applicable

Hi Tresesco,

Could you please explain what this piece of code is doing?:

Load

  State,

  MonthName(MonthYear) as MonthYear,

  Sales,

  If(State=Peek(State)RangeSum(Sales,Peek('NewSales')),  Sales) as NewSales;

tresesco
MVP
MVP

I am a bad teacher outside classroom. And a lazy long writer too. .  Still I would try to explain.

Assuming you are more interested in the last line of the code segment. It checks if the current row State is same as the one last loaded, if they are same the a new field NewSales would be created that calculates as the sum of two units - the previous NewSales and the current Sales. This eventually accumulates the earlier sales because the NewSales is actually recursive; the earlier one has all the earliers. If the IF condition fails, i.e. - earlier state is not same with the current state (this will only happen for the first row for new state), we need not accumultate (other state's sale should not considered in another state).

Hoe this helps.

Not applicable

Thanks. It is clear now:)