Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
| ID | Date | Sales |
| 1 | 1/1/2017 | 10000 |
| 2 | 2/2/2017 | 20000 |
| 3 | 3/2/2017 | 30000 |
| 4 | 4/2/2017 | 40000 |
| 5 | 5/3/2017 | 50000 |
| 7 | 1/1/2016 | 5000 |
| 8 | 2/1/2016 | 10000 |
| 9 | 3/1/2016 | 15000 |
| 10 | 4/1/2016 | 20000 |
| 11 | 5/1/2016 | 25000 |
| 12 | 6/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
Eve, When you are selected 2016 why YTD sales is 0 and PYTD sales has some value? Does it make sense to you?
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
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
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
One more question?
How come LYTD is 75000 rather 102000?
Output i got something like below for 2017
and for 2016, I got it like below
Note - Enclosed Attached the QVW
Hi Mahesh,
see Attachment.
Regards,
Antonio.

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
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.
I think AM already provided, Have a look Antonio solution. If not, We may offer you nearest to next reply