BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Renan_Crepaldi
Obsidian | Level 7

Hi everyone!

 

I'm kinda new to the SAS VA and I'm not being able to create a specific calculated field.

 

The idea is to calculate the average revenue/coupons we'll have to make on the rest of the year to complete our year goal.

 

My data is on the store level, so I'll have to aggregate it to make these as big numbers. I've attached a sample of the table I'm using.

 

The difficult part is to calculate the amount of months left in the year to use it as the denominator. Using the revenue as example, the formula I thought was something like:

 

Sum [_ForAll_] ((
IF ( Month('anoMesData'n) <= ( Month(DatePart(Now())) - 1 ) )
RETURN 'revenueGoal2020'
ELSE . )) -
Sum [_ForAll_] (( IF ( Month('anoMesData'n) <= ( Month(DatePart(Now())) - 1 ) ) RETURN 'revenue2020' ELSE . ))/
202012 - Month(DatePart(Now()))

Is this the best way to make this calculation?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Renan_Crepaldi
Obsidian | Level 7

Hello!

 

So, a person from my area was able to help me on this problem. I only needed to put a function to aggregate the data of the denominator.

 

The formula that worked stayed like this:

 

( Sum [_ForAll_] ('revenueGoal2020'n) - Sum [_ForAll_] ((
IF ( Month('MONTH_YEAR'n) <= ( Month(DatePart(Now())) - 1 ) )
RETURN 'revenue2020'n
ELSE . )) ) / Max [_ForAll_] (( 12 - ( Month(DatePart(Now())) -
1 ) ))

View solution in original post

3 REPLIES 3
Renan_Crepaldi
Obsidian | Level 7
Just to clarify, the equation I'm trying to make is:

(Year Revenue Goal 2020 - YTD Revenue 2020)/(Months left on 2020)

This would be the same for the coupons
Renan_Crepaldi
Obsidian | Level 7

Just updating:

I was able to put the logic on a formula, but it's giving an error because the denominator is not aggregated.

The formula I've programmed is:

 

( Sum [_ForAll_] ('revenueGoal2020'n) / Sum [_ForAll_] ((
IF ( Month('DATE'n) <= ( Month(DatePart(Now())) - 1 ) )
RETURN 'revenue2020'n
ELSE . )) ) / ( 12 - ( Month(DatePart(Now())) - 1 ) )

Am I doing something wrong?

 

Thanks!

Renan_Crepaldi
Obsidian | Level 7

Hello!

 

So, a person from my area was able to help me on this problem. I only needed to put a function to aggregate the data of the denominator.

 

The formula that worked stayed like this:

 

( Sum [_ForAll_] ('revenueGoal2020'n) - Sum [_ForAll_] ((
IF ( Month('MONTH_YEAR'n) <= ( Month(DatePart(Now())) - 1 ) )
RETURN 'revenue2020'n
ELSE . )) ) / Max [_ForAll_] (( 12 - ( Month(DatePart(Now())) -
1 ) ))

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 3 replies
  • 493 views
  • 0 likes
  • 1 in conversation