Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
Not applicable

Subtract one year in date MM/YYYY

Hi everyone. I've managed to build up a table that sum revenues for a certain period based on my selection.

Now, I'd like to add a new column to my table showing revenues for the previous year, given the same period (in months) selected.

Please see screenshot for details.

Thanks in advance for your help!

Please note that

- the selected date field name is "selecteddate"

- the date I used in the if function is "recorddate"

- the revenues field name is "revenues"

Tags (3)
1 Solution

Accepted Solutions

Re: Subtract one year in date MM/YYYY

May be this

Sum({<recorddate = {"$(='>=' & Date(AddYears(Min(selecteddate), -1), 'MM/YYYY') & '<=' & Date(AddYears(Max(selecteddate), -1), 'MM/YYYY'))"}>}revenues)

3 Replies

Re: Subtract one year in date MM/YYYY

May be this

Sum({<recorddate = {"$(='>=' & Date(AddYears(Min(selecteddate), -1), 'MM/YYYY') & '<=' & Date(AddYears(Max(selecteddate), -1), 'MM/YYYY'))"}>}revenues)

Not applicable

Re: Subtract one year in date MM/YYYY

Great, it worked like a charm.

Thanks a lot.

Can I just substitute "-1" with "+1" in order to add one year right?

Re: Subtract one year in date MM/YYYY

Yes