# calculate Previous Month Amount

Hello Experts,
we have a requirement to build the below logic in Webi Report. Please help me with finding the logic to calculate Amounts for the previous month and year

1. Prompt Date is 8/1/2019 - 8/31/2019 (always run for the month)
2. Column 1: Date (8/1, 8/2, 8/3, 8/4…8/31)
3. Column 2: Amount (100, 200, 300,… 1,000)
4. Column 3: Previous Month Amount (I don’t how to calculate) need help on this
5. Column 4: Amount should calculate from Jan/2019 to Aug/2019 (This should dynamically work based on prompt. let’s say if I pick March then it should go back and calculate from Jan to March)
6. Column 5: same as Column 4 but it need to calculate previous year

Attached Sample screenshot for better understanding.

bmsreddy100 (BOB member since 2019-12-19)

with function RelativeDate() you can pick the values from previous month/year/etc.

n8aktiv (BOB member since 2018-12-29)

Thank you for the Function. how can I sum the amount based on the previous date?

Here is my logic, which I wrote in the Variable and it has some data type issue.

=Sum([RWBTR]) Where (RelativeDate([ZALDT];-1;MonthPeriod))

Object Qulaification:
RWBTR = (Qualification = Measure, Type = Number, and Aggrative function = sum in the universe)
(tried changing Qualifcation = Dimension and Type = Number still no luck)

ZALDT = Dimension and Date

bmsreddy100 (BOB member since 2019-12-19)

the comparative-operator is missing in your where-clause

something like:
[ZALDT] = RelativeDate([ZALDT];-1;MonthPeriod)

n8aktiv (BOB member since 2018-12-29)

Now I’m able to show the previous month from “ZALDT” Object but unfortunately, the Amount is not working with the previous month. Can you please help me out on that particular logic.

Tried something like this and it got datatype issue:
=Sum([RWBTR]) Where (RelativeDate([ZALDT];-1;MonthPeriod))

Thanks,
MB

bmsreddy100 (BOB member since 2019-12-19)

I am also facing same issue