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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Analysis - prior year; current month and week expressions question

I'm trying to get a set analysis on Prior Year, Current Month Sales;

My set analysis I'm trying is

Sum({$<Year={$(=Max(Year)-1)}>{$<Month={$(=Max(Month))}>}[sales])

The expression above comes up with nothing.  What am I missing?

and Prior Year - relative week (example: 8/27/12 current year week; 8/26/11 - prior year week)

sum({$<Year={"<=$(=Max(Year)-1)"},Week={$(=Max(WeekBeginDate))}=>}[sales])

This also comes up with nothing. 

Any help is appreciated.  Thanks in advance.

2 Replies
swuehl
MVP
MVP

If you e.g. select on Date field, you need to clear that field in your set expression to get around incompatible selections (also, if you can select on other fields, consider clearing them when they get in conflict with selections you do in your set modifier):

Sum({$<Year={$(=Max(Year)-1)}>{$<Month={$(=Max(Month))}, Date= >}[sales])


I haven't understood your second expression -  how is Week and WeekBeginDate defined.

It's usually easier in these cases to only operate on Date fields (e.g. using an advanced search expression), clearing all other calendar fields in your set expression.

Hope this helps,

Stefan

Not applicable
Author

Set analysis starts and ends with {}.  dollar sign is declared once.


Sum({$<Year={$(=Max(Year)-1)}>{$<Month={$(=Max(Month))}>}[sales])


So, the above set analysis expression would be:

Sum({$<Year = {$(=Max(Year)-1)}>,<Month={$(=Max(Month))}>}[sales])