# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
New Contributor III

## Rolling and YTD calculation

Hello,

I'm trying to calculate the rolling and ytd revenue, but not from the month of january to december. i need to do it from September 2017 to aug 2018 and sep 2018 to aug 2019. i'm using below code to ge the output. I have a filter called view in which i have two selection rolling and ytd. if i select rolling then the in the revenue text object the output should be current year rolling and last year revenue, if i select ytd from the view filter, then the revenue text object should de displayed as current year YTD and last year ytd revenue. with the below i'm not getting the desired output, the numbers are not correct.

='Current Year:'& Num(Sum({<[Trading Week End Date] = {">=\$(=MakeDate(Year(Today()),9,1) )<=\$(=MakeDate(Year(Today())+1,8,1) )"}> }>} NET_SLS_AMT/1000000),'##.00')& ' Last Year:'&Num(Sum({<[Trading Week End Date] = {">=\$(=MakeDate(Year(Today())-1,9,1) )<=\$(=MakeDate(Year(Today()),8,1) )"}> } NET_SLS_AMT/1000000),'##.00')

1 Solution

Accepted Solutions
Highlighted
Valued Contributor

## Re: Rolling and YTD calculation

what are the correct values?

Taoufiq ZARRA
18 Replies
Highlighted
New Contributor III

## Re: Rolling and YTD calculation

QVW file

Highlighted
Valued Contributor

## Re: Rolling and YTD calculation

can you please confirm these results.

Between the two dates d1 and d2, which represents the current year, I find 45.89, not 50.4.

'Current Year:'& Num((Sum({<week = {">=\$(d1) <=\$(d2)"}>} NET_SLS_AMT)/1000000),'##.00')

can you give me your feedback on that?

Taoufiq ZARRA
Highlighted
New Contributor III

## Re: Rolling and YTD calculation

total revenue os 104, and current year revenue is 50.4 and last year revenue is 53.7. attaching you the dataset

Highlighted
Valued Contributor

## Re: Rolling and YTD calculation

Sum(NET_SLS_AMT)/1000000 between  01/09/2018 and 01/08/2019 is 50.4 ?

how'd you find it ?

Taoufiq ZARRA
Highlighted
New Contributor III

## Re: Rolling and YTD calculation

In the dataset, there a column called period and if i select CYRoll12m then you see Net_sls_amt as 50.4 sep 2018 to aug 2019 and if i select LYRoll12m then the net_sls_amt is 53.7 sep 2017 to aug 2018.

Highlighted
Valued Contributor

## Re: Rolling and YTD calculation

Sum(NET_SLS_AMT)/1000000 between 01/09/2018 and 01/08/2019 is 45.86 not 50.4 ?

Taoufiq ZARRA
Highlighted
New Contributor III

## Re: Rolling and YTD calculation

sorry my bad, yes it is 45.86 i was looking at other dataset not shared one. really sorry for this.

Highlighted
Valued Contributor

## Re: Rolling and YTD calculation

qvw file

Taoufiq ZARRA
Highlighted
New Contributor III

## Re: Rolling and YTD calculation

haha.

we got the right numbers for current year