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

$ 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
sunny_talwar

Did you just say that YTDMonth is a variable? Are you sure it is a variable or you wanted to say its a field name? and can you not use what RubenMarin mentioned in his post?

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


to me this looks like a sleek solution for what you are trying to achieve, unless SpendYear's Year values doesn't match YTDMonth's Year values.

Best,

S

Not applicable
Author

Hi All

Many thanks for the suggestions and the help for this problem. Here are answer to two common questions asked above

1) YTDMonthID is a variable and not a field. It comes from the load script

2) YTDMonthID does not change with selection. However, the expression that I gave above changes its value with different selections. For example, If select any spendyear, the value of the expression changes but the YTDMonthId is always same .i.e 2015

Once again

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

changes with different spendyear

but

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

does not change with spendyear

I have also put the left(YTDMonthId,4) in a textbox just to see if the value changes and it does not

Shah

rubenmarin

Hi, you can set this expression in straight table without caption, this way you can see how QV is translating the $-expansion.

Maybe with

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

Or

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

Not applicable
Author

Can you send us what and how the value is being set for Variable: YTDMonth?

The example in the textbox you used is using YTDMonthid and not YTDMonth variable. So can you please share.

If YTDMonth is 201501, then does the SpendYear field also has the similar value in the same format to compare with YTDMonth?

Thanks,

Singh