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

Hi everybody,

 

How can I calculate a price average between two input date? I need let the user choose a start and end date to calculate a price average between this interval. I've tried to use a dropdown list, but the dropdown list filtered all my chart (the same to the slider) and I need just define a date interval to calculate and put the result in a simple text input (or any other out type to user visualization), without change my chart or data table. Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
gcarvalho
Obsidian | Level 7

Hi Thiago,

 

I would suggest you to use the Slider object to enter the date.

To avoid the date filter to change the information in all objects in your report, you can use the Slider inside a Container in your Report and instead of using the Filters in the Section Prompt.

This way you will have to create interactions within your Slider (Date Filter) and the objects that you want to filter, than you would have filtered only the objects you want an not all the report.

Once you have the date defined you can select your 'PriceInformation' table in your data source and change the aggregation to Avegare.

Maybe you want to duplicate your 'PriceInformation' data so you would have both, the Sum and Average, here are some screenshots.

 

I hope it helps!

 

1.jpg2.jpg3.jpg 

 

View solution in original post

7 REPLIES 7
PaigeMiller
Diamond | Level 26

 

How can I calculate a price average between two input date?

 

But what exactly is the problem? You make it sound as if computing an average is the problem, that's your first sentence and title. Surely that can't be the actual problem. Is the real problem how to let the user define the interval?

--
Paige Miller
thiagoglima
Obsidian | Level 7

 

 

I thought about using two text input to allow the user to enter dates, using two parameters to convert text to date, but I do not know how can I use those two dates to calculate an average between the interval.

 

"Is the real problem how to let the user define the interval?"

 

If you have a better suggestion to let the user define the interval, I would be grateful to know. As I sad, I've tried to use two dropdown list, but the dropdown list filtered all my chart =\

 

Thanks and sorry for my English. 

gcarvalho
Obsidian | Level 7

Hi Thiago,

 

I would suggest you to use the Slider object to enter the date.

To avoid the date filter to change the information in all objects in your report, you can use the Slider inside a Container in your Report and instead of using the Filters in the Section Prompt.

This way you will have to create interactions within your Slider (Date Filter) and the objects that you want to filter, than you would have filtered only the objects you want an not all the report.

Once you have the date defined you can select your 'PriceInformation' table in your data source and change the aggregation to Avegare.

Maybe you want to duplicate your 'PriceInformation' data so you would have both, the Sum and Average, here are some screenshots.

 

I hope it helps!

 

1.jpg2.jpg3.jpg 

 

thiagoglima
Obsidian | Level 7

Hi gcarvalho, thank you for the help!

 

I'll try your tip and come back here to tell you if it worked!

 

Thanks!

thiagoglima
Obsidian | Level 7

Thank you gcarvalho, your solution worked perfectly for me!

 

You can see the result in the attached image, thank you.

 

print.jpg

gcarvalho
Obsidian | Level 7

Hi Thiago, 

 

 

I'm glad to see that it works for you.

Looks like you are doing some reports in Portuguese, good to see SAS users from Brazil or Portugal maybe.

Thanks and best regards! 

thiagoglima
Obsidian | Level 7
Yes gcarvalho, you are right, I'm from Brazil! best regards to you too, thank you again!

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 7 replies
  • 2906 views
  • 4 likes
  • 3 in conversation