Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Comparison Data

I have a requirement to show Total Sales for the past 12 months, Total Sales for the past 6 months, and Total Sales for the current month, with a comparison to the same time frame from the prior year. I can't seem to figure out the best way to get there. Does anyone have any ideas?

4 Replies
Not applicable
Author

It can be something like this:

sum({1 <Date={"$(='>=' & AddMonths(min({$} Date), -12) & '<=' & AddMonths(max({$}Date), -12))"}>} Amount)


Not applicable
Author

Nick,

Thank you for your quick reply. I was out of the office when this came in. Is there a way I could pick your brain to understand some of the code you wrote. This did look like a reasonable solution, just trying to wrap my head around it.

Rick

Not applicable
Author

It will be easier if you ask a question. The expression which I've provided is pretty straight forward. All what you need is just to replace a calculation of start and end dates for a necessary period:

<pre>sum({1 <Date={"$(='>=' & date(Start date here) & '<=' & date(End date here))"}>} Amount)



Not applicable
Author

Nick,

I think I figured it out, the second time you sent with a bit more explanation helped.

Rick