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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

$ sign issue inside set analysis

Hi,

I have the below expression in chart

=sum({<SpendYear={"=$(=left(YTDMonth,4))"}>}SaleAmount)

YTDMonth is a variable and it is in the format 201501. I want the expression to evaluate only for 2015 and I wrote the above expression

The problem is that I do not want the above expression to change value with selection of SpendYear. However, it changes values if I select different years in SpendYear filter

In short, I want the above expression to behave like

=sum({<SpendYear={2015}>}SaleAmount) and if someone changes selection, it should not change

How to fix this?

Shah

13 Replies
Yousef_Amarneh
Partner - Creator III
Partner - Creator III

try this

=sum({<SpendYear={'$(=left(YTDMonth,4))'}>}SaleAmount)

Yousef Amarneh
sunny_talwar

I may be missing something, but whats wrong with using this expression in that case: =sum({<SpendYear={2015}>}SaleAmount)?

Best,

S

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

I got what you want exactly

try this

=sum({<SpendYear={'2015*'}>}SaleAmount)

Yousef Amarneh
rubenmarin1

Hi Syed, if you want to SpendYear to be always his max value you can use:

=sum({<SpendYear={$(=Max({1} SpendYear))}>}SaleAmount)

In your expression, if there are more than one YTDMonth included in the selections, the Left funcion will return null()

sunny_talwar

Hi Yousef,

Why would you put an * next to year? Spend year will only be an year (nothing would be attached to it)

Best,

S

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

Hi sunidia,

Yes you alright, I thought the spend year format is YYYYMM

Yousef Amarneh
Not applicable
Author

YTDMonth is a variable so it always will have one value. I probably do not need to use a max function here.

I want to do it like Field = {"$(=expression)"} because there are many scenarios where I need the dollar sign expansion in the set analysis. However, I have trouble when the selection changes. I need to fix that

Shah

Yousef_Amarneh
Partner - Creator III
Partner - Creator III

If you can attached an example with sample of data it would be better, I cannot get your point

Yousef Amarneh
rubenmarin1

Ok, I readed it fast, if the values changes when you select another SpendYear, it means than it changes the value of YTDMonth variable.

First you can try what sunindia saids. If fixing set analysis to '2015' works as you expected, the problem is with the value contained in the variable, not in expression.