Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Year To Date Calculation

Hi All,

I have some sales data for which i want to calculate YTD. The months are expressed by numbers like Jan =1, Feb =2..and .so on. I want to calculate the total sales for the period April 2011 - March 2012. How do i go about it in my sum statement?

Regards

Anirban

4 Replies
Not applicable

Re: Year To Date Calculation

Add a new field in the script to give fiscal year. Something like

if(month<=3,Year-1&'-'Year,Year&'-'&Year+1) as FiscalYear.

Adding the FiscalYear in the list box would do the job.

Kiran Rokam.

Not applicable

Re: Year To Date Calculation

Hi Kiran,

Thanks for the reply. I wanted to ask you isnt there anything we could do without touching the back end script? I mean within the table can we use set analysis and get the job done.

Your views would be appreciated

Thanks

Anirban

jason_michaelid
Not applicable

Re: Year To Date Calculation

You should define the Fiscal year in the script, then use Set Analysis in the UI to sum values for that year.

In the script:

Year(YearStart(Date,0,4)     AS     FiscalYear

In the UI:

Sum({<Date=,Month=,Year=,FiscalYear=P()>} Sales)

This will sum all sales for the currently selected/possible FiscalYear(s)

Hope this helps,

Jason

Not applicable

Re: Year To Date Calculation

Assuming you have Year as a field use:

=Sum(if(if(month<=3,Year-1&'-'Year,Year&'-'&Year+1)='2011-2012',Sales,0))

Kiran.