Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Quick help on using Year variable instead of hard-coding.

Why is this expression not returning anything?

Sum ({<Yr=[MaxYrNum],WkNum=['<+$(=MaxWkNum)'}>} Sales). 

It works fine when the first part of the expression is....<Yr={'2011'}.  I'm just trying to replace the hard-coded year value for a dynamic value based on the max year (or another variable called MaxDt).

Thanks.

3 Replies
johnw
Champion III
Champion III

I think this?

sum({<Yr={'$(MaxYrNum)'},WkNum={"<$(MaxWkNum)"}>} Sales)

Not applicable
Author

Well, that doesn't seem to be working, and I can't tell why.  Thanks for the response.  If you have any other suggestions I'm wiling to try 'em.

johnw
Champion III
Champion III

Create a chart where that's the only expression.  Don't give that expression a label.  At that point, the caption line should show the expression prior to dollar sign expansion, and the header for the column should show AFTER dollar sign expansion (or do I have that backwards?).  That's often a good way to spot set analysis issues.  Often when set analysis isn't working, you'll see that the dollar sign expansion is just returning null, or is returning data in the wrong format.  The formats have to match - the year you should now have in quotes should match the format of your Yr field, and same for the WkNum field.  This won't necessarily let you spot the issue, but it's a good thing to try.