Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
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"

1 Solution

Accepted Solutions
sunny_talwar

May be this

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

View solution in original post

3 Replies
sunny_talwar

May be this

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

Not applicable
Author

Great, it worked like a charm.

Thanks a lot.

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

sunny_talwar

Yes