Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8944

Re: Cumulative Sum?

$
0
0

Hi Vishal,

 

 

Based on when user runs the report I want to fetch the current date and derive 'rolling 12 months cumulative' and 'rolling 3 years cumulative'.

 

If you want the data based on the report refresh date then no need of any prompts


1) Create universe level condition to get 3 years of data based on the current date

Table.Year between year(sysdate) and year(sysdate)-3

 

2)

Create report level variable

CurrentYear=Year(CurrentDate())

CurrentYearCummulativeSum=RunningSum([Profit for Each Month])

 

Use these variables along with Month object to get data related to current year

 

3) 3YearsData=RunningSum([Profit for Each Month];([Year]))

 

Use this variable along with year, Month to get the required output i.e cumulative 3 Years

 

But if you have the option of having Year and month as the prompts then you may have to follow different approach

 

1) Create universe level condition to get 3 years of data based on the current date

Table.Year *100 +Table.Month

between @prompt(Year)*100+@Prompt(Month) and (@prompt(Year)-3)*100+1

Basically you are comparing YearMonth combination

if user gives 2016 5 then your right side value will be 201605 and 201301

 

2) then the report level variables will be same as previous option mentioned

 

Note: I have given logical explanation and if you face any issue with actual implementation let me know


Viewing all articles
Browse latest Browse all 8944

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>