Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
In my attached file, i've a chart (Points) where I show values corresponding to the previous year to the selected one.
I also need to show (on the same chart) the selected year values for Comm and value fields.
I appreciate any help!
Hello!
Please, find a green table in the attachement. Is this the result you've wanted to achieve?
Hello!
Please, find a green table in the attachement. Is this the result you've wanted to achieve?
Not sure if understood right. To see, data for current selection (year) and last to current selection year, you may try using exp, like:
Sum({$+<Year={$(=(Year)-1)}>}Value)
Sergey, your reply is perfect. Please, could you explain me how does it work the expresions with pick, match, and
ValueList?
What's the different between $(=(Year)-0) and $(=(Year))?
Thanks for your invaluable help!!
Regards
Hi Tresesco. Thanks for be willing to help and try to solve my question.
I've seen your file and it really does not fit my question (may be my own fault) but your expresision also show the selected year and i only have to show previous selected year with selected year values in another column.
Regards!!
Glad to help 😃
ValueList() creates a field with some values, it's often used for creating a dimensions.
If we have numeric values like ValueList(1,2,3) then we can use Pick() for setting an expression values for it:
=pick(
valuelist(1,2,3)
,sum(sales)
,count(orders)
,count(customers)
)
But, if we have a string values such as ValueList('jan', 'feb', 'mar') than we can't use Pick() function directly, we should use Match() function for support:
pick(
match(
valuelist('jan', 'feb', 'mar')
,'jan'
,'feb'
,'mar'
) //will return 1,2,3 respectively
,sum({<mon={'jan'}>}sales)
,sum({<mon={'feb'}>}sales)
,sum({<mon={'mar'}>}sales)
)
In your case I've created one valued field with ValueList(Year) and when a user selecting some year the value of ValueList(Year) is changing.
Then all I've to do is set different expressions for different calculations (Y-0 and Y-1, Point and Values).
And there no difference between Y - 0 and Y, it's the matter of taste 😃
Hope I didn't explane it confusedly.
Sergey, Thanks for sharing your knowledge. I'lll try to assimilate your explanation.
Regards!!
HI Sergey! one more question
Changing the year on the imput box on my real application, the following message appears
"Error in expression: All parameters to ValueList must be constant"
On my application i have three tables linked by year field
Do you know any reason??
Regards.
Hello, Eva!
If you wish to use an inputbox you should replace 'Year' field in ValueList(Year) with your variable. And this replacement should be done in both dimension and expressions. Please, find the attached example.
Sorry I have not expressed myself correctly. I wanted to say list box.
The funny thing is that sometimes it fails and sometimes it does not
thanks for your patience!!