Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

 

2 Solutions

Accepted Solutions
saichawan
Contributor III
Contributor III
Author

Taoufiq_Zarra

I don't know if the attached version can help you.
I have replaced the vMin and vMax by current year and last year

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

21 Replies
Anil_Babu_Samineni

What purposely you are creating many duplicate threads? Original Thread here

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

Would you be able to provide a dashboard where we can see just the objects we are looking at and with a single tab? Right now, everytime I open this dashboard I have to spend time looking to see if I can find what you are referring to or ask you what it is. In general it will be easy for us to help if you do certain things to make it easy for us to help you such as

1) Provide the expected output based on selections and no selections

2) Provide just the charts/list boxes that we need to look at

saichawan
Contributor III
Contributor III
Author

it happend through mistake

saichawan
Contributor III
Contributor III
Author

sorry for the inconvinence.

in the summary tab,i have a revenue text object. if i select rolling from the filter the values are getting as per requirement. but when i select YTD from filter . only the current year values are getting displaced not the last year values.

saichawan
Contributor III
Contributor III
Author

QVW file

sunny_talwar

What would you want to see when you select YTD for Last Year?

saichawan
Contributor III
Contributor III
Author

Current year YTD and last year YTD. Right I'm getting values for rolling. If i select rolling from the view filter i get current year rolling revenue and last year rolling revenue. I'm hoping the same for YTD. i select YTD from view filter then in the text object of revenue. It should be displayed as current year YTD revenue and last year YTD revenue.

sunny_talwar

I have been trying really hard to help, but I am not able to get the information from you to help. Unless you can clearly give me what you want, I will have to let someone else help you out here.

Best,
Sunny

saichawan
Contributor III
Contributor III
Author

i'm really sorry for this miss coummincation.

now in the dashboard, i have three tabs. i'm concerned about the summary tab. In the summary i have a text object called revenue. as per code of the text object revenue, if select rolling from the view filter and Cy_rolling_12m from period fillter. i get current year revenue and last year revenue in the revenue text object. now if i select YTD from view filter you can see that last year revenue is always zero. i'm looking for the same output as the one when i select rolling from the view filter but for YTD revenue.  i select YTD from the view filter and CYTD or LYTD from period filter. i should be getting what is the current year YTD and last year YTD in the revenue text object

 

Thanks