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

Solved
Highlighted
Occasional Contributor
Posts: 10

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

[ Edited ]

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!

Accepted Solutions
Solution
‎10-09-2017 02:15 PM
Occasional Contributor
Posts: 15

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

Posted in reply to thiagoglima

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!

All Replies
Posts: 2,174

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

[ Edited ]
Posted in reply to thiagoglima

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
Occasional Contributor
Posts: 10

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

Posted in reply to PaigeMiller

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.

Solution
‎10-09-2017 02:15 PM
Occasional Contributor
Posts: 15

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

Posted in reply to thiagoglima

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!

Occasional Contributor
Posts: 10

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

Posted in reply to gcarvalho

Hi gcarvalho, thank you for the help!

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

Thanks!

Occasional Contributor
Posts: 10

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

Posted in reply to gcarvalho

Thank you gcarvalho, your solution worked perfectly for me!

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

Occasional Contributor
Posts: 15

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

Posted in reply to thiagoglima

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!

Occasional Contributor
Posts: 10

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

Posted in reply to gcarvalho
Yes gcarvalho, you are right, I'm from Brazil! best regards to you too, thank you again!
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
• 7 replies
• 604 views
• 4 likes
• 3 in conversation