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

Announcements
April 13–15 - Dare to Unleash a New Professional You at Qlik Connect 2026: Register Now!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Want to get previous years selected date sales values

Hi all,

I had reqirement where i need to compare previous year and current year sales.so, when i make selection on finyear,month,date

the report need to show for all those three filters.

current year sales

sum({<SalesFY={$(=max(SalesFY))},SalesMonthOrder={"<= $(=max({<SalesFY={$(=max(SalesFY))}>}SalesMonthOrder))"},Month=>}Sales)

Previous year sales

sum({<SalesFY={$(=max(SalesFY)-1)},SalesMonthOrder={"<= $(=max({<SalesFY={$(=max(SalesFY)-1)}>}SalesMonthOrder))"},Month=>}Sales)



Thanks in advance

10 Replies
Kushal_Chawda

try something like

For Current Year

if( getselectedcount(finyear) >0 or getselectedcount(month) >0 or getselectedcount(date) >0,

sum(Sales),

sum({<SalesFY={$(=max(SalesFY))},SalesMonthOrder={"<= $(=max({<SalesFY={$(=max(SalesFY)-1)}>}SalesMonthOrder))"},Month=>}Sales) )

For PreviousYear

if( getselectedcount(finyear) >0 or getselectedcount(month) >0 or getselectedcount(date) >0,

sum(Sales),

sum({<SalesFY={$(=max(SalesFY))},SalesMonthOrder={"<= $(=max({<SalesFY={$(=max(SalesFY)-1)}>}SalesMonthOrder))"},Month=>}Sales) )

Not applicable
Author

i think that is not correct because,when i select particular date i would like to see previous year and current year sales at a time.

Kushal_Chawda

lets say If you Have selected 13/4/2016 then what will be the output you need?

Not applicable
Author

if select one particular date

As per your answer it will give only current year sales only not previous year sales.

Kushal_Chawda

see this, Use Date field in set analysis

YTQ, QTD, MTD and WTD

Set Analysis for certain Point in Time

qliksus
Specialist II
Specialist II

Can you elaborate on what is the output currently shown and which expression is giving you wrong result ?. Also if you select a particular date then is your requirement  for

CY ---  >=Yearstartdate <= Selcted date

PY ---  >=YearstartdatePY <= PYSelcted date

Also how the O/P should be when you select only Year,Month and not date . It would be better if you can attach a sample

kkkumar82
Specialist III
Specialist III

Hi vijay,

do you have seperate fields for Year, Month, Day ??

Not applicable
Author

Not applicable
Author

i mean i unqiue date fields for year ,month,date for the report