Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

YTD Calculation For Specific Date

Hello all,

Probably a simple question really but here goes. I have an application whereby I want to build a YTD, MTD and QTD sales total within a Straight Table. I want the user to be able to click on a specific date (e.g. 28/02/2008) and be able to get the sales totals up to that date.

So for example if the user selects 28/02/2008 as a date from a list box, then the YTD sales will consist of all sales values from 01/01/2008 up to and inclusive of 28/02/2008. I also need to create the same but for the previous year so that the sales total would show 01/01/2007 to 28/02/2007.

Not really sure how to go about this, i've tried playing with if statements but have failed in creating a solution.

Any ideas anyone?

Cheers

2 Replies
Not applicable
Author

Hi again Guys,

Dont worry, cracked it, or at least I think so. For anyone interest this is the way I built the solution:



YTD - sum({1 < Report_DATE = {'>=$(=date(yearstart(Report_DATE))) <=$(=date(Report_DATE))'} >} Calc_Sales)

QTD - sum({1 < Report_DATE = {'>=$(=date(quarterstart(Report_DATE))) <=$(=date(Report_DATE))'} >} Calc_Sales)

MTD - sum({1 < Report_DATE = {'>=$(=date(monthstart(Report_DATE))) <=$(=date(Report_DATE))'} >} Calc_Sales)

Tryng to get the previous year ones working now, which should be fun.

Cheers,

qliksus
Specialist II
Specialist II

Hi paul,

I just go through your MTD solution . Exact similar type of expression i have written and it is working well but i want at this time MTD of prev month also. Can you give me any idea to solve ??? I treid with addmonth but it is giving 0.