Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi there,
I have the following expression: sum({$<[Trading Year] = {$(vMaxTYear)}, [Trading Month] = {$(vMaxTMonth)}, [Trading Day in Year] = {"<=$(vMaxTDay)"}, [Year] = , [Month Year] = >} [Sales Value @LSP])
This expression is supposed to ignore any selection done on [Year] and [Month Year]. However, my numbers change when I do a selection on [Year].
Is this a bug, or am I doing something wrong?
Regards,
Jean
Yes, if you want your variables to be independent from your selection in these fields, then you need to specify "[Year] = , [Month] = " also inside the variable definition.
I doubt that there is a bug here...
How are vMaxTYear, vMaxTMonth and vMaxTDay calculated? Do they depend on [Year] or on a field that changes when a selection is made in [Year]?
Hi there.
Thanks for your reply. vMaxTYear, vMaxTMonth and vMaxTDay are not dependent on [Year]. They do depend on fields that change when selections are made in [Year]. However, this should not be an issue because all selections made on [Year] should be ignored even in other fields.
No, that's not how it works.
If the variables are defined through expressions, they are evaluated from current selection. I.e. the variable values can change when you make selections.
The set expression will create a new selection which is used for that specific aggregation, and in your set expression the selection in [Trading Year], [Trading Month], and [Trading Day in Year] depend on current selection:
[Trading Year] = {$(vMaxTYear)},
[Trading Month] = {$(vMaxTMonth)},
[Trading Day in Year] = {"<=$(vMaxTDay)"},
So, your calculation may well change when you make a selection in [Year].
Hi Henric.
Thanks for your feedback. It is very helpful.
If the variables are defined through expressions and are evaluated from current selection, how can I change it to create MTD and YTD expressions? Do I also need to specify [Year] = , [Month] = inside the variable definition?
Yes, if you want your variables to be independent from your selection in these fields, then you need to specify "[Year] = , [Month] = " also inside the variable definition.
Thank you very much for your help, Henric.