Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
ravindraa
Creator
Creator

YTD and PYTD

Hi experts,

   i have struk one place please give me any suggesion to come out.

in my applicaiton i have year filed and sales country fileds i have to show country wise YTD and PYTD sales.

with out selection it is shwoing exact valeus if i select PYTD values is not showing the sales

YTD condition is from selected year start to current month.

PYTD condition is selected year prevous year start  till to same month of current month.

  Ex: if we select 2015 PYTD need to be display 1/12014 to currrent month oflast year 6/25/2014.

Please give me any sugession .

Please see the attached files

thanks in advance.

7 Replies
arulsettu
Master III
Master III

hi

check the attachment

ravindraa
Creator
Creator
Author

Hi Arul Settu,

  But if you select 2014 the YTD should display the 1-Jan-2014 to 25-June-2014 as YTD

  in PYTD should display the 1-Jan-2013 to 25-june-214 like this

  but here values is mismatching

please give me any suggesion

arulsettu
Master III
Master III

now check

Not applicable

Dear,

find attached file.

YTD & PYTD

let vmaxyear=max(Cal_year);

let vMaxDate=max(date)

YTD-          sum({<Cal_year={$(vmaxyear)},cal_month=, date={"<=$(vMaxDate)"}>}sales)

Regards

Vimlesh

sasiparupudi1
Master III
Master III

Hi

Use variables for your year and month selections and in the expressions,

YTD

sum({<Cal_year=, cal_month=,date={">=$(=MakeDate(vSelectedYear,1,1))<=$(=MakeDate(vSelectedYear,vSelectedMonth,1))"}>}sales)

PYTD

sum({<Cal_year=,cal_month=,date={">=$(=AddYears(MakeDate(vSelectedYear,1,1),-1))<=$(=AddYears(MakeDate(vSelectedYear,vSelectedMonth,1),-1))"}>}sales)

sasiparupudi1
Master III
Master III

Did you come alright with the script?

Nirpanthan
Contributor III
Contributor III

=(Sum({<Periodname,Segment3={440},ToDate={">=$(vStartDate)<=$(vTillDate)"}>}Closingbalance)+
Sum({<Periodname,Segment3={470},ToDate={">=$(vStartDate)<=$(vTillDate)"}>}Closingbalance)+
Sum({<Periodname,Segment3={480},ToDate={">=$(vStartDate)<=$(vTillDate)"}>}Closingbalance))/vThousand 

 

 i am not getting for pytd can you help