Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
try this
=sum({<SpendYear={'$(=left(YTDMonth,4))'}>}SaleAmount)
I may be missing something, but whats wrong with using this expression in that case: =sum({<SpendYear={2015}>}SaleAmount)?
Best,
S
I got what you want exactly
try this
=sum({<SpendYear={'2015*'}>}SaleAmount)
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()
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
Hi sunidia,
Yes you alright, I thought the spend year format is YYYYMM
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
If you can attached an example with sample of data it would be better, I cannot get your point
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.