BookmarkSubscribeRSS Feed
acordes
Rhodochrosite | Level 12

I want to aggregate for the upcoming next 12 months, so the calendar year shouldn't impact at all.

My first choice was the periodic cumulative measure but I cannot sum over the next 12 months. This goes against my understanding what this measure promises to do.

My workaround is to sum relative periods (0 to 11 by 1). This works but feels complicated.

 

Here comes the code for the aggregated measure outlook 12 months that fulfills the task. 

 

CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 1, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 2, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 3, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 4, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 5, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 6, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 7, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 8, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 9, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 10, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 11, 1, _Full_, {Date}) +
CumulativePeriod(_Sum_, 'Frequency'n, _IgnoreAllTimeFrameFilters_
, '_FECULVTO'n, _ByMonth_, _ByMonth_, 0, 1, _Full_, {Date})

 

cross.png

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 0 replies
  • 485 views
  • 0 likes
  • 1 in conversation