Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Karim_Khan
Creator III
Creator III

is this possible to show YTD,QTD and MTD show at same time

Hi Time,

    I am able to calculate YTD and MTD correctly.when am calculating the YTD without month selection it is coming correctly.But while calculating MTd at the time of month selection MTD is gettiong calculated coprtrectly but YTD's values alos gets chnaged and showing as the same.

Pls help how to do that?

Regards,

KK

KK
10 Replies
maxgro
MVP
MVP

could you post your Qlik doc?

maybe you need to disregard the month selection, something like adding a 

Month=

to your set analysis

sunny_talwar

Can you share your expressions for YTD and MTD

sunny_talwar

My guess is that you might need to add MonthField = to your YTD expression so that it ignores any selection in MonthField List box

Karim_Khan
Creator III
Creator III
Author

Hi Sunny,

    Pls chekc my expression

YTD

=sum({$<[FiscalYear] = {$(=only([FiscalYear]))}, [Week] = {'<=$(=max([Week]))'},[Week]=>} [Net Bookings])

MTD

=sum({$<[FiscalYear] = {$(=only([FiscalYear]))},[Month] = {$(=only([Month]))}, [Week] = {'<=$(=max([Week]))'},[Week]=>} [Net Bookings])

KK
Karim_Khan
Creator III
Creator III
Author

My Script is as follow

Cisco:

LOAD [End Customer Global Ultimate Name],

     Country,

     [End Customer HQ Top],

     [Sales Level 1],

     [Sales Level 2],

     [Sales Level 3],

     [Sales Level 4],

     [Sales Level 5],

     [Partner Name],

     [Fiscal Period ID],

    Year(date#([Fiscal Period ID],'YYYYMM')) as FiscalYear,

    //num(month(date#([Fiscal Period ID],'YYYYMM'))) as FiscalMonthNum,

    month(date#([Fiscal Period ID],'YYYYMM')) as FiscalMonth,

    Date(date#([Fiscal Period ID],'YYYYMM'),'DD-MM-YYYY') as FisDate,

    //floor(Date(date#([Fiscal Period ID],'YYYYMM'),'DD-MM-YYYY')) as DateNum,

    Week(Date(date#([Fiscal Period ID],'YYYYMM'),'DD-MM-YYYY')) as Week,

   

     FMV,

     [Net Bookings],

     Group

FROM

[\\arlmssan02\cm$\tp_managers\DBMIGrp\9. Team Members Folders\Karim\Assign_Project\Nikhil.G\CISCO\Copy of June raw.xlsx]

(ooxml, embedded labels, table is Sheet1);

//Left Join

//LOAD * Inline [

//FiscalMonthNum,CalenderMonth, CaldenderMonthNum,FiscalQuarter

//1,Aug,8,Q1

//2,Sep,9,Q1

//3,Oct,10,Q1

//4,Nov,11,Q2

//5,Dec,12,Q2

//6,Jan,1,Q2

//7,Feb,2,Q3

//8,Mar,3,Q3

//9,Apr,4,Q3

//10,May,5,Q4

//11,Jun,6,Q4

//12,Jul,7,Q4 ];

//

////Final:

////LOAD *,

////monthname(Date#(CalenderYear&CalenderMonth,'YYYYMMM')) as CalenderMonthYear,

////date(Date#(CalenderYear&CalenderMonth,'YYYYMMM'),'DD-MM-YYYY') as CalenderDate;

////

////LOAD

////FiscalYear,

////FiscalMonthNum,

////CalenderMonth,

////[Fiscal Period ID],

////if(CaldenderMonthNum>=8,FiscalYear-1,FiscalYear) as CalenderYear

////Resident  Cisco;

////

////////

////DROP Table Final;

//

//QuartersMap: 

//MAPPING LOAD  

//rowno() as Month, 

//'Q' & Ceil (rowno()/3) as Quarter 

//AUTOGENERATE (12); 

 

Temp: 

Load 

               min(FisDate) as minDate, 

               max(FisDate) as maxDate

              

              

Resident Cisco; 

 

Let varMinDate = Num(Peek('minDate', 0, 'Temp')); 

Let varMaxDate = Num(Peek('maxDate', 0, 'Temp'));  

DROP Table Temp; 

 

TempCalendar: 

LOAD 

               $(varMinDate) + Iterno()-1 As Num, 

               Date($(varMinDate) + IterNo() - 1) as TempDate 

               AutoGenerate 1 While $(varMinDate) + IterNo() -1 <= $(varMaxDate); 

 

MasterCalendar: 

Load 

               TempDate AS Date, 

               week(TempDate) As Week, 

               Year(TempDate) As Year, 

               Month(TempDate) As Month, 

               Day(TempDate) As Day, 

               YeartoDate(TempDate)*-1 as CYTD, 

               YeartoDate(TempDate,-1)*-1 as LYTD, 

               inyear(TempDate, Monthstart($(varMaxDate)),-1) as Rolling12, 

               date(monthstart(TempDate), 'MMM-YYYY') as MonthYear, 

               ApplyMap('QuartersMap', month(TempDate), Null()) as FiscalQuarter, 

               Week(weekstart(TempDate)) & '-' & WeekYear(TempDate) as WeekYear, 

               WeekDay(TempDate) as WeekDay 

Resident TempCalendar 

Order By TempDate ASC; 

Drop Table TempCalendar; 

KK
Karim_Khan
Creator III
Creator III
Author

Tnx a ton Sir JI.Its resolved now.

Sir for QTD

=sum({$<[FiscalQuarter] = {$(=only([FiscalQuarter]))},[Month] =, [Week] = {'<=$(=max([Week]))'},[Week]=>} [Net Bookings])

above expression will work or not?

KK
sunny_talwar

Try this for YTD:

=Sum({$<[FiscalYear] = {$(=only([FiscalYear]))}, [Week] = {'<=$(=max([Week]))'}, [Month]=>} [Net Bookings])

Karim_Khan
Creator III
Creator III
Author

But how to show the Fiscal Quarter for this one?Pls review my Script and help for the same


I want the Fiscal Quarter

Q1-Aug,Sep,Oct

Q2-Nov,Dec,Jan

Q3-Feb,Mar,Apr

Q4-May,Jun,Jul

KK
Karim_Khan
Creator III
Creator III
Author

Hi Sir any Hope

KK