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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
dmac1971
Creator III
Creator III

Prev YTD

This expression is "nearly" working, expect that it only gives me last Feb and not Jan & Feb?

=SUM({<Year={'$(vPriorYear)'},Month={'$(vMaxMonth)'}>} Sales)

Any idea what I need to change?

Thanks.

Labels (1)
5 Replies
Not applicable

Writing Month={'$(vMaxMonth)'} means it will show the last month, you might want to change that

Cheers,

Lucas

lironbaram
Partner - Master III
Partner - Master III

try this

SUM({<Year={'$(vPriorYear)'},Month={'<=$(vMaxMonth)'}>} Sales)

dmac1971
Creator III
Creator III
Author

For some reason changing to

SUM({<Year={'$(vPriorYear)'},Month={'<=$(vMaxMonth)'}>} Sales)

Gives me 0, I had tried this before.  Maybe its how I am setting up the variable?


vMaxMonth = Month(max([Transaction Date]))

Not applicable

Setting vMaxMonth to Month(max([Transaction Date])) means you will get 1 month, try making another variable v2ndLastMonth = Month(max([Transaction Date])-1) and then adding it into your set analysis. This will give you the last month and the second-last month

DavidFoster1
Specialist
Specialist

It is either (have not had chance to test....)

1) the <= quote are in the wrong place:

SUM({<Year={'$(vPriorYear)'},Month={<='$(vMaxMonth)'}>} Sales)

2) You need to use double quotes to get the expression to evaluate in the brackets

SUM({<Year={"$(vPriorYear)"},Month={"<=$(vMaxMonth)"}>} Sales)