I want to calculate revenue for last 90 days according to transaction date

the enddate is a parameter, attached snap,
periodToDateSum(Revenue, {transaction_date}, ‘DAY’, addDateTime(-90, ‘MM’, ${Enddate}))
i tried this formula this is not giving me any results.

main request here is, how can i calculate sum of revenue for last 60 days using the maximum date available in the transaction field?

First you would get rid of subtracting 90 months from the end date. You want it up to the parameter date and that can be controlled in a filter that’s linked to the parameter.

Something like this.

Then I would make a calculated field that checks if your date is less than 60 days away from your parameter date.

ifelse(dateDiff(${EndDate},{transcation_date})<60,'Show','Do not show')

And then add this as a filter to your visual as well.

Finally I would look to make it a sumOver or running sum instead of periodToDateSum because you have now filtered the visual to the time period you want.

1 Like