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: 
paulwalker
Creator III
Creator III

Need Help??

Hi All,

LOAD * Inline [

Id, PostingDate, Amount

101,02/09/2014,1000

102,03/09/2014,1100

103,04/09/2014,1200

104,23/09/2014,1300

105,08/09/2014,1400

106,09/09/2014,1500

107,10/09/2014,1600

108,12/09/2014,1700

109,15/09/2014,1800

110,16/09/2014,1900

111,17/09/2014,2000

112,18/09/2014,2001

113,19/09/2014,2002

101,02/09/2013,1000

102,03/09/2013,1100

103,04/09/2013,1200

104,05/09/2013,1300

105,08/09/2013,1400

106,09/09/2013,1500

107,10/09/2013,1600

108,12/09/2013,1700

109,15/09/2013,1800

110,16/09/2013,1900

111,17/09/2013,2000

112,18/09/2013,2001

113,19/09/2013,2002

];

Here i want to calculate FTD, MTD and YTD script level..

i am using this code..

LOAD *, If(PostingDate=Today(), 'FTD',

  If(PostingDate>=MonthStart(Today()), 'MTD',

  If(PostingDate>=YearStart(Today(),0,4), 'YTD'))) as PostDate;    

but it showing wrong data..

Thanks in advance..............

8 Replies
Not applicable

what's the data you want?

Sorry but i don't get...

is that what you want???

Not applicable

Hi,

Is that what you want to know like a attach file ?!

Regards,

WanKi,

paulwalker
Creator III
Creator III
Author

Hi,

Thanks for reply..

Suppose if i have Customer wise date

FTD=100

MTD=100+Remaining values(Only for current month)

YTD=MTD+total year values (financial year)

FTD=100

MTD=100+200(remaing value)

YTD=300+Total year

Hope you understand.........

Anonymous
Not applicable

Hi Paul,

if i understood you correctly,you mean.

FTD--today

MTD-for current month

YTD-Since beginning of year Till Today...right?

Thanks

Manish Madan

paulwalker
Creator III
Creator III
Author

Yes..

paulwalker
Creator III
Creator III
Author

please  anyone can help me................

mjayachandran
Creator II
Creator II

may be the below post helps, u have to tweek a little

http://community.qlik.com/blogs/qlikviewdesignblog/2014/03/03/ytd

tresesco
MVP
MVP

Create separate flags like:

Result:
LOAD  *,
  If(Date(PostingDate) = Today(), 1,0) as FTDFlag,
  If(Date(PostingDate) >= MonthStart(Today()), 1,0) as MTDFlag,
  If(Date(PostingDate) >= YearStart(Today(),0,4), 1,0) as YTDFlag
Resident Temp1;

Drop table Temp1;

See attached sample too.