Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikview979
Specialist
Specialist

YTD,PYTD

Hi Experts,

I have  2 years of data  in 2017,2016 .I want sales of YTD,PYTD.


In front end i want show like this


When i open qv in list box should be default selection in max year and In text objects  i want to show YTD,PYTD.


   

IDDateSales
11/1/201710000
22/2/201720000
33/2/201730000
44/2/201740000
55/3/201750000
71/1/20165000
82/1/201610000
93/1/201615000
104/1/201620000
115/1/201625000
126/1/2016

27000

Expected output:-

when i open QV and selection of 2017

YTD Sales is 150000

PYTD Sales is 75000


When i select 2016


YTD Sales is 0

PYTD Sales is 102000


In case i have 2015 data in source file i want like this  if i select 2016 i want


2016 as YTD Full sales

2015 as PYTD Full sales

Labels (1)
9 Replies
Anil_Babu_Samineni

Eve, When you are selected 2016 why YTD sales is 0 and PYTD sales has some value? Does it make sense to you?

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
arvind_patil
Partner - Specialist III
Partner - Specialist III

H mahes,

For PYTD use below expression:

Sum({<Date={">=$(=Num(YearStart(Max(Date), -1)))<=$(=AddYears(Max(Date), -1))"}>} Sales)


For YTD use below Expression:


Sum({<Date={">=$(=Num(YearStart(Max(Date))))<=$(=Max(Date))"}>} Sales)



Thanks,

Arvind Patil

qlikview979
Specialist
Specialist
Author

Sorry anil,

When i select 2016 ,i want to show 2016 as YTD, 2015 data as PYTD(if 2015 data is available in source)

Regards

qlikview979
Specialist
Specialist
Author

Hi Arvind, when i  go for default selection 2017 PYTD is showing "0"but here

when i go for default selection 2017


2017  data should be 150000

2016  data should be 75000



when i go for selection 2016(if 2015 sales like 100000)


2016  data should be 102000

2015  data should be 100000


Regards


Anil_Babu_Samineni

One more question?

How come LYTD is 75000 rather 102000?


Output i got something like below for 2017

Capture.PNG

and for 2016, I got it like below

Capture.PNG

Note - Enclosed Attached the QVW

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
antoniotiman
Master III
Master III

Hi Mahesh,

see Attachment.

Regards,

Antonio.

qlikview979
Specialist
Specialist
Author

HI Anil,

logic is in the  year 2017 having 5 months of data like Jan,Feb,Mar,Apr,May

in the  year 2016 having 6 months of data like Jan,Feb,Mar,Apr,May,june


when select 2017

i want the 5 months sales from 2017(YTD)

i want the 5 months sales from 2016   (PYTD) (I don't want June data)


when i select 2016  i want all months data from 2016(YTD)

i select 2016  i want all months data from 2015(IN CASE DATA IS AVAILABLE IN SOURCE OTHER WISE "0")




Regards

Mahesh


balar025
Creator III
Creator III

Get last 6 month record from selected month number

Might this help you.

Only change is, you can create one more Rolling Type by PYTD and change cndtion to Year-1.

Anil_Babu_Samineni

I think AM already provided, Have a look Antonio solution. If not, We may offer you nearest to next reply

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