Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
carlos_horta1
Contributor III
Contributor III

sum previous year sales ignoring month selection QlikView

Hi,

I have problems with the expression and I need help. I have a straight table where I compare current year/month sales with last year/month.

I select the month and the year and it will show me the sales for the same month in the current and previous year. One of my expression shows me the total sales for last year for each item but i need it to ignore the month selection and that it always shows me the whole previous year.

I am using expression =sum({$(vSETPYTD), <Month=>} Sales) but I get no results. If I only use =sum($(vSETPYTD) Sales) I get the previous year amazon but only for the month that is selected.


How can I ignore the month selection?

1 Solution

Accepted Solutions
carlos_horta1
Contributor III
Contributor III
Author

I Think I solve it. I use the expression I got when only typing { $<Year={2017},MonthDayNo={"<831"},Month=,[Month Year]=,Quater=,Date=>}, I erase MonthDayNo={"<831"} that was doing some calculation that didn't allow me to get only the whole years sales.


Thank you so much everybody.

View solution in original post

11 Replies
andrey_krylov
Specialist
Specialist

Hi, what's the value of this variable vSETPYTD? Or try this

sum({<Month=, Year = {"$(=Year(Today()) -1)"} >} Sales)

lorenzoconforti
Specialist II
Specialist II

You had an extra < in your expression. This should work

=sum({$(vSETPYTD), Month=>} Sales)

andrei_delta
Partner - Creator III
Partner - Creator III

hi,

since i don't know what your variable value for the vSETPYTD is all i can say is that this expression (sum({$(vSETPYTD), <Month=>} Sales) ) has syntax problems...


the correct syntax is sum({<Month=,$(vSETPYTD)>} Sales)

hope it helps,

Andrei

lorenzoconforti
Specialist II
Specialist II

It actually looks like you have angle brackets in your variable

You can remove the angle brackets from the variable and then write your expression like this:

=sum({<$(vSETPYTD), Month=>} Sales)


Or you can leave them in your variable and rewrite the expression using the intersection operator:


=sum({$(vSETPYTD) * <Month=>} Sales)


carlos_horta1
Contributor III
Contributor III
Author

Tbh, I am not sure since I'm taking the program from someone else and I don't have access to the script or I don't know to to get there. It helps me get the previous year data (Sales, quantity, etc). When I type $(vSETPYTD) as an expression on my straight table I get this expression when I select year 2018 and month Aug:

{ $<Year={2017},MonthDayNo={"<831"},Month=,[Month Year]=,Quater=,Date=>}

carlos_horta1
Contributor III
Contributor III
Author

I tried and it didn't work. I don't know why

carlos_horta1
Contributor III
Contributor III
Author

Thanks Andrei. I tried it and it didn't work. vSETPYTD helps me getting the previous Years to Day values.

When I type $(vSETPYTD) as an expression on my straight table I get this expression when I select year 2018 and month Aug:

{ $<Year={2017},MonthDayNo={"<831"},Month=,[Month Year]=,Quater=,Date=>}

carlos_horta1
Contributor III
Contributor III
Author

I tried both and none of them worked

andrei_delta
Partner - Creator III
Partner - Creator III

so if you want to use the expression you will write it like sum ( $(vSETPYTD )  Sales ) and can you edit the variable?