Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis

Hi Friends,

The aim is take the maximum of YEAR and then maximum of WEEK of Sales, when I try the below expression which is not working, could you please correct me where I need to correct.

=Sum({<YEAR={"$(=Max(YEAR))"},WEEK={"$(=Max(WEEK))"}>}Sales)

Thanks

Chriss

1 Solution

Accepted Solutions
tresesco
MVP
MVP

You can try like this:

=Sum({<YEAR={"$(=Max(YEAR))"},WEEK={"$(=Max({<YEAR={"$(=Max(YEAR))"}>}WEEK))"}>}Sales)

Assuming your week field has numeric data(1,2,...52)

View solution in original post

5 Replies
Not applicable
Author

Hi Chriss

I guess you have many years so max(year)=2014 but max(Week)=52  which is the max for 2013

I think it is the reason  because you don't have 52 weeks in 2014 yet

So you shoud use a combined Week-Year field

best regards

Chris

tresesco
MVP
MVP

You can try like this:

=Sum({<YEAR={"$(=Max(YEAR))"},WEEK={"$(=Max({<YEAR={"$(=Max(YEAR))"}>}WEEK))"}>}Sales)

Assuming your week field has numeric data(1,2,...52)

Not applicable
Author

Hi, Tresesco and Chris,

Thanks and it works like a charm.... and for my knowledge, pls correct me if I am wrong.

so first it takes the Max of YEAR like (2014) ie, 2012, 2013, 2014 and it takes the max of WEEK as we are ie 24th week but in between the bold part why we need that Max of YEAR again.

Please explain...

Many thanks...

Chriss

Anonymous
Not applicable
Author


Hi Chriss,

The bold part of the set analysis expression is written because:

"To get the max week for that max year"

Not applicable
Author

Thanks Karthigayan,  now its clear..

Regards

Chriss