periodToDateSumOverTime is not working

hi

A specific graph was not drawn in quicksight, so I checked the Athena query and found that the query also failed.

This is error message :

The function “periodtodatesumovertime” is not work in athena dataset?

If so, is there another way to get the running total for the date? In the case of runningsum, I used this because I thought the value kept changing depending on the date filter.

Hello @orangchan !

That error message is saying that the calculation doesn’t exist in Athena. Depending on what you want to calculate this could be done in Quicksight.

When you say that you want to use a filter to affect the date, are you wanting to use a control filter as the period in the periodtodatesum?

thanks to reply, @duncan
umm…

i want runningSum, but calculation level is ‘PRE-FILTER’

Hey @orangchan !

You could add a calculated field to your dataset during data preperation in Quicksight or on the analysis level. Something like the calculation below:

periodToDateSumOverTime(sum({sales}), {OrderDate}, MONTH)

MONTH here means Month To Date, but if you do not choose a time granularity it will default to what’s in your field well.

thx @duncan .

I referred to this document and found out that period is optional.

but sorry for i’m beginner,
I don’t know exactly how to use the function. How can I use the default value instead of MONTH??

i tried this :

periodToDateSumOverTime(sum({sales}), {OrderDate})
periodToDateSumOverTime(sum({sales}), {OrderDate}, )
periodToDateSumOverTime(sum({sales}), {OrderDate}, "")
periodToDateSumOverTime(sum({sales}), {OrderDate}, '')
periodToDateSumOverTime(sum({sales}), {OrderDate}, default)
periodToDateSumOverTime(sum({sales}), {OrderDate}, DEFAULT)
periodToDateSumOverTime(sum({sales}), {OrderDate}, NULL)
periodToDateSumOverTime(sum({sales}), {OrderDate}, {OrderDate})
periodToDateSumOverTime(measure = sum({sales}), dateTime={OrderDate})

but, all is systax error…

Hello @orangchan !

No problem at all, totally understand!

The default value will come from the field well aggregation for your date field. For example, in this visual I have the Order_Date set to (MONTH).

That being said, I ran a few tests and am running into the same syntax error. For now I would add the time granularity that you would like to measure for.

If you want this to be dynamic you could use a multiselect parameter control in your calculated field to create that effect for your dashboard readers.

got it. i understand

thx @duncan

1 Like