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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Year to Date and Month To Date problem

Hi,

Could someone kindly tell me how to calculate YTD and MTD sales for financial years having the format 2010-11.

Thanks a lot in advance

Gaurav V.

10 Replies
Not applicable
Author

HI plzz find the below code :

YTD--------------
COUNT(DISTINCT{$<[CAL YEAR] = {$(=max([CAL YEAR]))}, Cal_Month_No ={"<=$(=max({<[CAL YEAR]={$(=max([CAL YEAR]))}>} Cal_Month_No))"}>} [CASEID])


MTD--------------
COUNT(DISTINCT {$<GEO={'APAC'},[CAL YEAR] = {$(=max([CAL YEAR]))}, Cal_Month_No = {"<=$(=max({<[CAL YEAR]={$(=max([CAL YEAR]))}>} Cal_Month_No))>$(=max({<[CAL YEAR]={$(=max([CAL YEAR]))}>} Cal_Month_No)-1)"}>} CASEID)


QTD---------------
COUNT(DISTINCT {$<GEO={'APAC'},[CAL YEAR] = {$(=max([CAL YEAR]))}, Cal_Qtr = {$(=MaxString({<[CAL YEAR]={$(=max([CAL YEAR]))}>} Cal_Qtr))}, Cal_Month_No = {"<=$(=max({<[CAL YEAR]={$(=max([CAL YEAR]))}>} Cal_Month_No))"}>} CASEID)

you can also use the function YTD , MTD ------> refer help in qlikview

kaushalview
Partner - Creator II
Partner - Creator II

Hi,

Use this code for find MTD,FTD,YTD

Use this Variable to find MTD,YTD,FTD
-------------------------------------------------------------------------------------------
VD(Maxday)=Max(if(ACFinYear=VY and AccountMonthNo=VM, AccoutnDay))
-------------------------------------------------------------------------------------------
VM(Maxmonth)=Max(if(ACFinYear=VY, AccountMonthNo))
-------------------------------------------------------------------------------------------
VY(MaxYear)= =Max(ACFinYear)
-------------------------------------------------------------------------------------------

Expression
----------------------------------------------------------------------------------------------------

MTD=sum(if(VY=CompareYear123 and VM=CommMonth and VD>=Pday, AMOUNT))
----------------------------------------------------------------------------------------------------

YTD=sum(if(VY=CompareYear123 and ((VM*100)+VD)>=Month_Day, AMOUNT))
---------------------------------------------------------------------------------------------------

FTD=sum(if(VY=CompareYear123 and VM=CommMonth and VD=Pday, AMOUNT))
---------------------------------------------------------------------------------------------------

Regards

Kaushal mehta

suniljain
Master
Master

Dear

This Very old approach, Common Boss

kaushalview
Partner - Creator II
Partner - Creator II

Hi,

The new approach ( using Set Analysis) was already listed. Hence I thought of suggesting an alternative which can be incorporated in the versions prior to QV 9.0.

Regards

Kaushal Mehta

Not applicable
Author

Many-Many thanks Aswin....

Hope you are doing best in your life....

would speak to you soon...

bye...

Not applicable
Author

Many - many thanks , dear Kaushal.....

Not applicable
Author

Dear Ashwin,

Hope you doing well....

Please tell me how to calculate YTD for any fiscal year in the past like 2010-11. Our fiscal starts from July and ends in Jun.

Also, kindly tell me, how to come come up with sum of sales for any number of monthyears in any fiscal year.

For eg. if you select 2010-11 which starts on 1st July and ends on 31 Jun. If a user selects 14 feb 2011, he should get the sales for the period - 1st July 2010 to 14Feb2011.

Thanks for your help...

Gaurav VArshney

Not applicable
Author

Dear Kaushal,

Hope you doing well....

Please tell me how to calculate YTD for any fiscal year in the past like 2010-11. Our fiscal starts from July and ends in Jun.

Also, kindly tell me, how to come come up with sum of sales for any number of monthyears in any fiscal year.

For eg. if you select 2010-11 which starts on 1st July and ends on 31 Jun. If a user selects 14 feb 2011, he should get the sales for the period - 1st July 2010 to 14Feb2011.

Thanks for your help...

Gaurav VArshney

Not applicable
Author

HI gaurav , I am fi9 and nw days in mumbai. what about u .????

Please use the Inline Table for Financial Year. And link it with the calender.

This is also available in the Tutorials you can refer how to make Quarters and Fiscal Year.

You can contact me +91 9769948351