Obsidian | Level 7

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

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
Obsidian | Level 7

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

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!

7 REPLIES 7
Diamond | Level 26

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

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
Obsidian | Level 7

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

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.

Obsidian | Level 7

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

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!

Obsidian | Level 7

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

Hi gcarvalho, thank you for the help!

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

Thanks!

Obsidian | Level 7

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

Thank you gcarvalho, your solution worked perfectly for me!

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

Obsidian | Level 7

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

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!

Obsidian | Level 7

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

Yes gcarvalho, you are right, I'm from Brazil! best regards to you too, thank you again!
Discussion stats
• 7 replies
• 2048 views
• 4 likes
• 3 in conversation