@Bilal_Shakir
There is actually a way to do it. It can be done using calculated fields at both the data prep and UI layers. Max’s suggestion is still valid, but if you want to give it a try here is how it works:
I have a date (my date is EFX_EXTRACT_DATE) and a measure (EFX_LOAMOUNT). As you can see from the tables below, the first table with 3 rows (last 3 days in my dataset) shows the correct running sums for each of those last 3 days:
First Step:
At the data pre layer, before you ingest data into Quicksight, create two calculated fields:
Basically, the first one assigns the same value (the day before the last date in my dataset) to all the dates BUT the last day. The second one, assigns the same value (two days before the last day in my data set) to all dates but the last Two days in my data set. It is important to note that these two new calculated fields have only 1 value (and nulls) so when we will use them later to partition a sumOver, the partition will be done by one value only across the entire column.
Second Step
Then Publish and Save. In the UI layer, create a calculated field like this:
ifelse(
{EFX_EXTRACT_DATE}=maxOver({EFX_EXTRACT_DATE},, PRE_FILTER), sumOver(({EFX_LOCAMOUNT}), , PRE_FILTER),
{EFX_EXTRACT_DATE}=maxOver({MaxDay_1},, PRE_FILTER), sumOver(({EFX_LOCAMOUNT}), [{MaxDay_1}], PRE_FILTER),
{EFX_EXTRACT_DATE}=maxOver({MaxDay-2},, PRE_FILTER), sumOver(({EFX_LOCAMOUNT}), [{MaxDay-2}], PRE_FILTER),
NULL
)
Add this new field to the visual. Then add your date as a filter to the visual. Select Top and Bottom for filter type. Enter 3 as the numbers of values to be returned.
In Order by select your Date and MAX as the aggregation
Apply and Voila!
Let me know how it works for you.
I am marking my reply as, “Solution,” but let us know if this is not resolved. Thanks for posting your questions on the QuickSight Community Q&A Forum!