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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

[HELP] sum to current selection date

Hello QlikView expert..

i want to sum all sales from beginning of date to current date

for example  :

1. if i select year 2013, then the sales will sum from beginning of year (2010 for example) until the last sales in 2013

2. if i don't select anything, then the sales will sum from beginning of year until the last date of current year (2014)

how to do that with set analysis?

i'm lack a little bit of this

many thx before

1 Solution

Accepted Solutions
Not applicable
Author

thx massimo, i try to combine yours with sokkorn's and it works just like i want to

and the script is :

=if(GetSelectedCount(year)>0,

sum({$ <year={"<=$(=max(year))"}> } sales),               // all years until max selected

Sum({<orderdate = {">=$(=YearStart(orderdate))<=$(=Date(Max(orderdate)))"} >} sales)                    // max year  

)

View solution in original post

4 Replies
maxgro
MVP
MVP

GetSelectedCount (or GetPossibleCount) to check how many years selected/possible in Year field

=if(GetSelectedCount(Year)>0,

sum({$ <Year={"<=$(=max(Year))"}> } Expression1),               // all years until max selected

sum({$ <Year={$(=max(Year))}> } Expression1)                      // max Year   

)

Sokkorn
Master
Master

Hi Rendi,

Here is concept.

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

Can you attached your app?

Regards,

Sokkorn

Not applicable
Author

thx massimo, i try to combine yours with sokkorn's and it works just like i want to

and the script is :

=if(GetSelectedCount(year)>0,

sum({$ <year={"<=$(=max(year))"}> } sales),               // all years until max selected

Sum({<orderdate = {">=$(=YearStart(orderdate))<=$(=Date(Max(orderdate)))"} >} sales)                    // max year  

)

Not applicable
Author

thx sokkorn, it really helpful