Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
saichawan
Contributor III
Contributor III

YTD calculation

Hi,

I have the code below which calculates the current year rolling sales and lasy year rolling sales. i'm not able to do the same for ytd calculation in the same code. i have filter of view with option of (rolling and ytd). if select rolling from the filter i can sales in text object with current year rolling sales and last year rolling sales. I want the same to be calculated for YTD.

Attaching you the QVW file and aslo the code for rolling calculation.

='Current Year:'& Num((Sum({<week = {">=$(vMinDate)<=$(vMaxdate)"}>} NET_SLS_AMT)/1000000),'##.00')
& ' Last Year:'&num((((Sum({<week = {">=$(vRollingStart)<=$(vRollingEnd)"},Period=>} NET_SLS_AMT)/1000000)
-
Sum({<week = {">=$(vRollingStart)<=$(vRollingEnd)"},Period= {'LYTD'}> } NET_SLS_AMT)/1000000)),'##.00')

 

Thanks

 

21 Replies
saichawan
Contributor III
Contributor III
Author

i'm posting the question right away

purna
Contributor III
Contributor III

 

YTD:

sum({$<date={">=$(=yearstart(max(date)))<=$(=max(date))"},year=,month=,day=>}sales}

 

QTD;

sum({$<date={">=$(=quaterstart(max(date)))<=$(=max(date))"},year=,month=,day=>}sales}

same for MTD,WTD replace month start, week start in the place of year start..

please let me know if i am wrong..